4
mail($to, $subject, $message, $headers);

the $header is:

From: from-me@mymail123.com
Reply-To: from-me@mymail123.com
Content-Type: text/html; charset=iso-8859-1
X-Mailer: PHP/5.2.5
MIME-Version: 1.0

I built $header with those line and I changed the order in every way, putting the Mime in the beginning, at the end, moving the from and reply around adding and deleting the X-mailer line. The results are the same. Gmail and yahoo are fine and the email is an empty attachment when set to outlook 2003.

Any thoughts?

sdfor

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
sdfor
  • 6,324
  • 13
  • 51
  • 61

3 Answers3

5

thanks for the thoughts. I tried phpMailer and got stuck on a "Could not instantiate mail function" error. I posted a question about that too.

But I figured out the problem. Outlook requires a doctype and that the HTML be correct. gmail will take almost anything. \

The following works!

//the message:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body>
<h1>HTML EMAIL</h1>
</body>
</html>

//the headers

$headers = "From: $from\n"
$headers .= "Reply-To: $replyto\n"
$header .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";

// the mail call

mail($to, $subject, $message, $headers);
Kokos
  • 9,051
  • 5
  • 27
  • 44
sdfor
  • 6,324
  • 13
  • 51
  • 61
2

Personnally, i prefer using phpmailer, available on sourceforge. It offers a much more robust mailing solution. I use it to send our email newsletter. Very reliable.

pixeline
  • 17,669
  • 12
  • 84
  • 109
0

Try adding to the end of 'From: ...'. This email should be an actual email address on the server. Try checking your spam folder with what you have.

Fiarr
  • 858
  • 5
  • 16