HTML in UDT?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
CMSmonkey
Power Poster
Power Poster
Posts: 290
Joined: Thu Nov 27, 2008 4:58 pm

HTML in UDT?

Post by CMSmonkey »

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.
alby

Re: HTML in UDT?

Post by alby »

CMSmonkey wrote: however, I cannot get the HTML/CSS style to show in the email.
may not work because you use smarty tag in head (useless because they do not use smarty here)

PS: what mean?
$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";
use real values: 'Website Mailing List'  and  'info@website.com'

Alby
Post Reply

Return to “Developers Discussion”