Jump to content

Recommended Posts

I have a script that sends the user a html email. The script worked fine when I tested it. It sent the html email to me correctly, I'm using WinXP with Outlook2007. When my client tests it using Vista with Outlook2007, the headers, after the first line, are pushed into the begging of the body. This makes it so the email is not html and all of the html code is printed as text. And there is no from field, so the email winds up in the spam box. The only thing that is different is the operating system. Is there something in vista that is causing this? And is there anything I can do to fix it?

 

Note, the first header line is in the email header in vista. If I put the Content-type on the first line, the email comes through as html. If I put the From on the first line, there is a From header in the email. The second two lines always print at the top of the body.

 

Here is my mail code (with website replaced):

 

$to = $_POST['email'];

$headers  = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= 'From: www.website.com <me@website.org>' . "\r\n";

$subject = "My Subject";

$body = "Thank you for using the website.com application\r\n";

$body .= $contents;

$body = wordwrap($body);

if (mail($to, $subject, $body, $headers)) {

  header('location:file.php?email='.$_POST['email']);

} else {

  echo("<p>An error has occured. Cannot connect to email server.</p>");

}

Link to comment
https://forums.phpfreaks.com/topic/56114-solved-php-mail-headers/
Share on other sites

You should use Zigmoyd Mail Class its easy, Cool and fast. and all Mails goes to Inbox.

Its Too Simple

$mail = new mail("admin@localhost", "Subject", "<b>This is My <i>HTML</i> Mail</b>");
//or
$body = "<b>This is My <i>HTML</i> Mail</b>";
$mail = new mail("admin@localhost", "Subject", $body);

Its manual is aviliable here http://zigmoyd.sourceforge.net/man/mail.php#mail

See Installations and Instructions from here. http://zigmoyd.sourceforge.net/man/index.php.

And the programmer of this Class is very helpfull and also Regular in this Forum.And Yes The User Will reacieve HTMl Email. You dont need to declkeare MIME type . It decides and decleares it By its AI.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.