Unsubscribe part 2
-
I saw an old topic sending an unsubscribe link in the emails beautified by this plugin. Since I can’t reply to that topic anymore, I’m opening this hoping it will be useful to someone.
We also needed this functionality in all of the mails sent from our website. In order to get this done I modified the function send_html in wpbe.php. Maybe this is useful for someone else as well.
function send_html( $phpmailer ) { // Added the possibility to have the %to% field in the mail template, for example for unsubscribe functionalit $email_address = $phpmailer->getToAddresses(); $phpmailer->AltBody = str_replace('%to%', $email_address[0][0], $this->process_email_text($phpmailer->Body)); if ( $this->send_as_html ) { $phpmailer->Body = str_replace('%to%', $email_address[0][0], $this->process_email_html($phpmailer->Body)); } }
In order to add unsubscribe functionality, you could add something like this to your template:
<a href="https://mywebsite.com/unsubscribe/?email=%to%">Unsubscribe</a>
Caveat: it only works for the first To-address in the mail.
- The topic ‘Unsubscribe part 2’ is closed to new replies.