xProteuSx Posted January 11, 2012 Share Posted January 11, 2012 I've been using something like this to send email messages to users on a site: $to = $email; $subject = "Message From Microsoft.com\r\n"; $headers = "From: [email protected]\r\n"; $headers .= "Return-Path: [email protected]\r\n"; $headers .= "Reply-To: [email protected]\r\n"; $message = "<html><body><img src='http://www.Microsoft.com/images/logo.png' /><br /><br />You have a message from Bill:<br /><br />"; $message .= '<img src="' . $image . '" /><br /><br />'; $message .= 'Isn't it pretty?.<br /><br />'; $message .= '<a href="http://www.Microsoft.com">Microsoft.com</a></body></html>'; mail($to,$subject,$message,$headers); This sends, literally, text like this: <html><body><img src='http://www.Microsoft.com/images/logo.png' /><br /><br />You have a message from Bill:<br /><br /><img src="http://www.Microsoft.com/images/billiam.jpg" /><br /><br />Isn't it pretty?.<br /><br /><a href="http://www.Microsoft.com">Microsoft.com</a></body></html> Obviously, I would like the email to hide the HTML, but use it to format the output. Also, I'd obviously like the image to show up, not a link to the image, and I would like the link to show up as a link, not as HTML. How do I do this? Cheers. Link to comment https://forums.phpfreaks.com/topic/254775-how-to-create-html-e-mails/ Share on other sites More sharing options...
trq Posted January 11, 2012 Share Posted January 11, 2012 Have you checked the manual? See mail. Link to comment https://forums.phpfreaks.com/topic/254775-how-to-create-html-e-mails/#findComment-1306362 Share on other sites More sharing options...
xProteuSx Posted January 11, 2012 Author Share Posted January 11, 2012 $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; ... that was the key. Link to comment https://forums.phpfreaks.com/topic/254775-how-to-create-html-e-mails/#findComment-1306394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.