I am not getting my email in HTML format, am i getting my headers wrong?
I don't have anything special, but should i have some kinda content type in the header? if so what is the code.
If i simply use my script to send an email, the email i receive is always plain text.
Easy email question
Moderator: General Moderators
It's the standard way of making a mailer:
Code: Select all
$headers = "From: <{$CFG['site_mail']}>\n";
$headers .= "X-Sender: [" . $CFG['site_name'] . "]\n";
//$headers .= "X-Priority: 1\n"; //Need checkbox
$to = $_POST['email'];
$subject = 'Newsletter Signup Confirmation';
$encryptmail = //secret hash
$content .= 'This is a confirmation email that you have been added to ' . $CFG['site_name'] . '''s newsletter.
You will receive monthly updates and events.
To unsubscribe from this newsletter click the link: <a href="' . $CFG['site_url'] . 'signup.am?action=unsubscribe&code=' . $encryptmail . '>link</a>';
//Send Email
mail($to,$subject,$content,$headers);Code: Select all
$headers = "From: <{$CFG['site_mail']}>\r\n";
$headers .= "X-Sender: [" . $CFG['site_name'] . "]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html\r\n";
$to = $_POST['email'];
$subject = 'Newsletter Signup Confirmation';
$encryptmail = //secret hash
$content .= 'This is a confirmation email that you have been added to ' . $CFG['site_name'] . '''s newsletter.
You will receive monthly updates and events.
To unsubscribe from this newsletter click the link: <a href="' . $CFG['site_url'] . 'signup.am?action=unsubscribe&code=' . $encryptmail . '>link</a>';
mail($to,$subject,$content,$headers);Yes mime types...where was i with my head...
thanks...
If anyone needs it...
thanks...
Code: Select all
if (isset($vars['html'])) {
$headers .= "Content-Type: text/html; charset=$charset\n"; // Mime type
}
else {
$headers .= "Content-Type: text/plain; charset=$charset\n";