I set up a mailing list signup form in Form Builder and I need to have it send a different email to the user depending on whether they subscribe or unsubscribe.
So I set up a UDT and it is functioning (with the exception of it properly showing the $headers information in the email) - however, I cannot get the HTML/CSS style to show in the email. Can someone please look at this and let me know what I should do or what I am missing?
[php]
$sendTo = "info@website.com";
$subject = "Mailing List Subscription";
$headers = "From: " . $_POST['name'] ." \r\n";
$headers .= "Reply-To: " . $_POST['email'] . "\r\n";
$headers .= "Return-path: " . $_POST['email'];
$headers .= "Mime-Type: text/html";
$message="
{literal}
{/literal}
You have received the following mailing list subscription entry:
name: ".$name."
email: ".$email."
please ".$subscribe."
";
$clientsendTo = "$email";
$clientsubject = "Website Mailing List";
$clientheaders = "From: " . $_POST['Website Mailing List'] ." \r\n";
$clientheaders .= "Reply-To: " . $_POST['info@website.com'] . "\r\n";
$clientheaders .= "Return-path: {$_POST['info@website.com']}\r\n";
$clientheaders .= "Mime-Type: text/html";
if($subscribe=="subscribe"){
$clientmessage="
{literal}
{/literal}
{$name},
Thank you for signing up for our mailing list. We will keep you updated on any news and coming events in the area, insha Allah.
";
}
else
{$clientmessage="
{literal}
{/literal}
{$name},
We are sorry to hear that you no longer want to take part in our mailing list. Should you change your mind, please visit us again and sign up for our mailing list
";
}
// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);
mail($clientsendTo, $clientsubject, $clientmessage, $clientheaders);
echo " Thank you, {$name}.
We will update our mailing list database shortly with your subscription.
";
[/php]
Thanks.
HTML in UDT?
Re: HTML in UDT?
may not work because you use smarty tag in head (useless because they do not use smarty here)CMSmonkey wrote: however, I cannot get the HTML/CSS style to show in the email.
PS: what mean?
use real values: 'Website Mailing List' and 'info@website.com'$clientheaders = "From: " . $_POST['Website Mailing List'] ." \r\n";
$clientheaders .= "Reply-To: " . $_POST['info@website.com'] . "\r\n";
$clientheaders .= "Return-path: {$_POST['info@website.com']}\r\n";
Alby