On Thu, 15 Nov 2007 09:58:59 -0500, "Brad" <[EMAIL PROTECTED]> wrote: > Still parsing as text and not html! > > <a href="http://www.zoneofsuccessclub.com">link </a> > //<a href="http://www.zoneofsuccessclub.com">link </a> > > $email = $_REQUEST['email'] ; > $fromaddress .= '[EMAIL PROTECTED]'; > $fromname .= 'Zone of success Club'; > $eol="\r\n"; > $headers = "From: ".$fromname."<".$fromaddress.">".$eol; > $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol; > $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol; > $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol; > $headers .= "X-Mailer: PHP ".phpversion().$eol; > $body .= "--".$htmlalt_mime_boundary.$eol; > $body .= "Content-Type: text/html; charset=iso-8859-1".$eol; > $body .= "Content-Transfer-Encoding: 8bit".$eol.$eol; > $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n"; > mail($email, $subject, $body, $headers); > > -----Original Message----- > From: Per Jessen [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 15, 2007 9:48 AM > To: php-general@lists.php.net > Subject: RE: [PHP] Cannot send a hyperlink > > Brad wrote: > >> Beginning with >> $headers .= "--".$htmlalt_mime_boundary.$eol; >> It starts to read it as text and not html?? >> >> Could this be a server side problem? > > Nope. > >> $email = $_REQUEST['email'] ; >> $fromaddress .= '[EMAIL PROTECTED]'; >> $fromname .= 'Zone of success Club'; >> $eol="\r\n"; >> $headers = "From: ".$fromname."<".$fromaddress.">".$eol; >> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol; >> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol; >> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol; >> $headers .= "X-Mailer: PHP ".phpversion().$eol; >> $headers .= "--".$htmlalt_mime_boundary.$eol; >> $headers .= "Content-Type: text/html; charset=iso-8859-1".$eol; >> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol; >> $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n"; > > You have a MIME boundary where it doesn't belong. MIME boundaries are > for the body, not the header. > > > /Per Jessen, Zürich
Exactly. The boundry should be part of the body. And i agree with stut. Just use PHPMailer for this stuff. That's what it's for. When sending mail from PHP i always make sure there is a fallback for clients that don't accept HTML mail. When using your snippet my mail ends up in the junkmail box. And it's not HTML either. The headers are messed up. So a small example: $boundary = md5(uniqid(rand(), true)); $headers = "From: name <[EMAIL PROTECTED]>\r\n"; $headers .= "To: name <[EMAIL PROTECTED]>\r\n"; $headers .= "Subject: some subject\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/alternative; boundary=" . $boundary . "\r\n"; $body = "\r\n\r\n--" . $boundary . "\r\n"; $body .= "Content-Type: text/plain; charset=iso-8859-1\r\n\r\n"; $body .= "... plain text test version ...."; $body .= "\r\n\r\n--" . $boundary . "\r\n"; $body .= "Content-Type: text/richtext; charset=iso-8859-1\r\n"; $body .= ".... richtext test version ..."; $body .= "\r\n\r\n--" . $boundary . "\r\n"; $body .= "Content-Type: text/html; charset=iso-8859-1\r\n"; $body .= ".... HTML version ..."; $body .= "\r\n\r\n--" . $boundary . "--\r\n"; mail("[EMAIL PROTECTED]", "(some subject)", $body, $headers); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php