SystemOverload Posted September 9, 2009 Share Posted September 9, 2009 Well I've done the code for a basic html email, now I want to create an email with plain text and html, for maximum compatability... I was recommended to find a class etc.. but i want to do it from scratch.. The email is sending, but when i view it in windows live (a live co uk email), it's blank... Can anyone shine a light on this??? My PHP is: $semi_rand = md5(time()); $varBoundary = "==Multipart_Boundary_x{$semi_rand}x"; $vTo = $varTo; $vSubject = $varSubject; $varMessage = wordwrap($varMessage); $varMessagePlus = wordwrap($varMessagePlus); $varHeaders = "From: donotreply@somewhere.info" . "\n"; $varHeaders .= "Reply-To: support@somewhere.info" . "\n"; $varHeaders .= "MIME-Version: 1.0\n"; $varHeaders .= "Content-type: multipart/alternative; boundary=\"{$varBoundary}\"" . "\n"; $vHeaders = $varHeaders; $vMessage = "This is a multipart message in MIME format." . "\n" . "\r\n\r\n--" . $varBoundary . "\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"" . "\n" . "Content-Transfer-Encoding: 7bit" . "\n" . $varMessage . "\r\n\r\n--" . $varBoundary . "\n" . "Content-Type: text/html; charset=\"iso-8859-1\"" . "\n" . "Content-Transfer-Encoding: 7bit" . "\n" . $varMessagePlus . "\r\n\r\n--" . $varBoundary . "--"; if (@mail($vTo, $vSubject, $vMessage, $vHeaders) or die()) { return 0; } else { return 1; } The source for the resultant email is: X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtTQ0w9Mw== X-Message-Status: n:0 X-SID-PRA: donotreply@locateme.info X-Message-Info: JGTYoYF78jFo0fMWAWRa/U5XMCnQ9sKUucqF/OgvT0eS7L/cF/OPgKbB0TbyCsdQYQtaYfzda/MRBCOZcNyK3nxKrmuiOELU Received: from WebServer1.DNPwebhosting.com ([213.175.208.2]) by SNT0-MC3-F38.Snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Sep 2009 13:06:17 -0700 Received: from WebServer1 ([127.0.0.1]) by WebServer1.DNPwebhosting.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Sep 2009 21:06:54 +0100 Date: Wed, 09 Sep 2009 21:06:54 +0100 Subject: Test Message To: system.overload@live.co.uk From: donotreply@locateme.info Reply-To: support@locateme.info MIME-Version: 1.0 Content-type: multipart/alternative; boundary="==Multipart_Boundary_x020feb40747da5aca2aa8dccc9fd3050x" Return-Path: donotreply@locateme.info Message-ID: <WEBSERVER1Aq9KP8RlR00000021@WebServer1.DNPwebhosting.com> X-OriginalArrivalTime: 09 Sep 2009 20:06:54.0233 (UTC) FILETIME=[13959090:01CA3189] This is a multipart message in MIME format. --==Multipart_Boundary_x020feb40747da5aca2aa8dccc9fd3050x Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit This is a plain text message... --==Multipart_Boundary_x020feb40747da5aca2aa8dccc9fd3050x Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <html> <body> <h1>This is the HTML Message</h1> <p>With some more text...</p> </body> </html> --==Multipart_Boundary_x020feb40747da5aca2aa8dccc9fd3050x-- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.