I believe you need the af/email/before_send
hook. I found this solution here: https://gist.github.com/mishterk/70bb486baac349c29b684346b77826ce
Rather than permanently modifying the email saved with the form entry, you can simply modify the message field to encode the email.
For example:
<?php
// Set the form key you wish to target
$form_key = 'form_5d97cf9edc0a8';
add_action( "af/email/before_send/key=$form_key", function ( $email, $form ) {
add_filter( 'wp_mail', function ( $data ) use ( $email ) {
// Take the "to" field and search for it in the message.
// If it exists, replace it with a base64 encoded version inside the message.
if($data['message'] && strpos($data['message'], $data['to'])){
$data['message'] = str_replace($data['to'], base64_encode($data['to']), $data['message']);
}
//Message before: Click on this link to unsubscribe <a href="https://wordpress.stackexchange.com/questions/354372/example.com/[email protected]">Click Here</a>
//Message after: Click on this link to unsubscribe <a href="example.com/?email=dGVzdEB0ZXN0LmNvbQ==">Click Here</a>
return $data;
} );
}, 10, 2 );
Please note, this has not been tested.