Forum Moderators: coopster
I have a problem when sending HTML mail (using css). The mails just incluse all the HTML tags...
So can you send both text and HTML so that the server receiving can use the text mail if HTML mail is not supported?
Or is it always best only to use plain text as I understand is advised? - it is the first time Ill use the mail() function.
Thanks
Having said that, to send HTML email you need to look into MIME types and headers.
<?php
function send_mail($fromname,$fromemail,$toname,$toemail,$message,$subject,$priority){
// check priority
if($priority=="High" ¦ $priority=="high" ¦ $priority=="1" ¦ $priority==1){
$xprior = 1;
$prior = "High";
}elseif($priority=="Normal" ¦ $priority=="Medium" ¦ $priority=="3" ¦ $priority==3){
$xprior = 3;
$prior = "Normal";
}elseif($priority=="Low" ¦ $priority=="low" ¦ $priority=="5" ¦ $priority==5){
$xprior = 5;
$prior = "Low";
}else{
$xprior = 3;
$prior = "Normal";
}$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$fromname." <".$fromemail.">\r\n";
$headers .= "To: ".$toname." <".$toemail.">\r\n";
$headers .= "Reply-To: ".$fromname." <".$fromemail.">\r\n";
$headers .= "X-Priority: ".$xprior."\r\n";
$headers .= "X-MSMail-Priority: ".$prior."\r\n";
$headers .= "X-Mailer: yourdomain.com";
$success = mail("", $subject, $message, $headers);
return $success;
}
?>