Hi, i’m developing a snippet to send a email to an eligable person for voting on a subject.
I want to insert a header in the email “List-Unsubscribe” with a value. Anyone know how to insert this header?
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY,$message);
$modx->mail->set(modMail::MAIL_FROM,'website@mydomainname.tld');
$modx->mail->set(modMail::MAIL_SENDER,'website@mydomainname.tld');
$modx->mail->set(modMail::MAIL_FROM_NAME,'My website name');
$modx->mail->set(modMail::MAIL_SUBJECT,'Subject for the email');
$modx->header->set('List-Unsubscribe','unsub@mydomainname.tld');
$modx->mail->address('to','eligableperson@hisdomainname.tld', 'Name person');
$modx->mail->address('reply-to','website@mydomainname.tld');
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'Fout bij verzenden email: '.$modx->mail->mailer->ErrorInfo);
}
$modx->mail->reset();