SCook Posted December 27, 2008 Share Posted December 27, 2008 Hi all, I would like to send an html email with a pic inside. I've set it up with tables and etc. I've included the mime version and content-type: text/html in the header. It's not working. Can anyone give me a quick example or some help on it? Thanks Link to comment https://forums.phpfreaks.com/topic/138554-sending-html-emails/ Share on other sites More sharing options...
kenrbnsn Posted December 27, 2008 Share Posted December 27, 2008 Please post your code between tags. Ken Link to comment https://forums.phpfreaks.com/topic/138554-sending-html-emails/#findComment-724445 Share on other sites More sharing options...
SCook Posted December 27, 2008 Author Share Posted December 27, 2008 function sendVideoEmail($mID, $id) { global $access; // Get the member's email and name $query = "select first_name,email from members where id = $mID;"; $result = mysql_query($query, $access); $mem = mysql_fetch_row($result); // Get the email data $query = "select * from adv_mail where id = $id;"; $result = mysql_query($query, $access); $mail = mysql_fetch_array($result); // Get the advetisers contact info $query = "select * from advertisers where id = " . $mail["aID"] . ";"; $result = mysql_query($query, $access); $adv = mysql_fetch_array($result); // Compose the email $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "To: $mem[1]\n"; $headers .= "From: www.stirfrytv.com\n"; $body = " <html> <head> <title>Stir Fry TV Message,/title> </head> <body> <table width = 100% border = 0> <tr> <td>Hello, $mem[0]</td> </tr> <tr><td height = 20></td></tr> "; if ($mail["image_placement"] == "t") { $body .= " <tr> <td align = 'center'> <img src = 'http//65.254.38.55/~river/emails/$id.jpg' border = 0> </td> </tr> <tr><td height = 10></td></tr> <tr> <td>" . $mail["msg"] . "</td> </tr> "; } elseif ($mail["image_placement"] == "b") { $body .= " <tr> <td>" . $mail["msg"] . "</td> </tr> <tr><td height = 10></td></tr> <tr> <td align = 'center'> <img src = 'http//65.254.38.55/~river/emails/$id.jpg' border = 0> </td> </tr> "; } $body .= " <tr><td height = 20></td></tr> <tr> <td> "; $body .= "<b>" . $adv["company"] . "</b><br>"; $body .= $adv["street_address"] . "<br>"; if ($adv["address_line_2"] != "") { $body .= $adv["address_line_2"] . "<br>"; } $body .= $adv["city"] . ", " . $adv["state"] . " " . $adv["zip"] . "<p>"; $body .= "Phone: <b>" . $adv["phone"] . "</b><br>"; $body .= "E-mail address: <b><a href = 'mailto:" . $adv["email"] . "'>" . $adv["email"] . "</a></b>"; $body .= " </td> </tr> </table> </body> </html> "; if (!mail($mem[1], $mail["subject"], $body, $headers)) { return true; } } Link to comment https://forums.phpfreaks.com/topic/138554-sending-html-emails/#findComment-724447 Share on other sites More sharing options...
timmah1 Posted December 27, 2008 Share Posted December 27, 2008 I don't understand why you have this $headers .= "To: $mem[1]\n"; Then, if (!mail($mem[1], $mail["subject"], $body, $headers)) Wouldn't it be simpler to define the $to without the header? $to = $mem[1]; if ($to, $mail["subject"], $body, $headers)) Link to comment https://forums.phpfreaks.com/topic/138554-sending-html-emails/#findComment-724559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.