Jump to content

[SOLVED] Email


spamoom

Recommended Posts

I have made a simple newsletter for one of my customers, and have recently found out that it does not allow html. I am sure it should... here is the code

 

<?php
} else {
$title = $_POST['title'];
$message = $_POST['message'];
$query = $db->query("SELECT * FROM newsletter");
$fetch = $db->fetch($query);
while ($fetch) {
	mail ($fetch['email'], $title, $message, 'From: [email protected]');
	echo "Sent to ".$fetch['email']."\n";
	$fetch = $db->fetch($query);
}
}
?>

 

Any Ideas?

Link to comment
https://forums.phpfreaks.com/topic/56543-solved-email/
Share on other sites

You just need to add the mimetype to your headers.

 

<?php
} else {
$title = $_POST['title'];
$message = $_POST['message'];
$query = $db->query("SELECT * FROM newsletter");
$fetch = $db->fetch($query);
        $headers = "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
        $headers .= 'From: [email protected]';
while ($fetch) {
	mail ($fetch['email'], $title, $message, $headers);
	echo "Sent to ".$fetch['email']."\n";
	$fetch = $db->fetch($query);
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/56543-solved-email/#findComment-279270
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.