Page 1 of 1

PHP Mail() on IIS problem

Posted: Tue May 18, 2010 11:09 am
by koolsamule
Hi Chaps,

I've been searching on Google for ages now and can't seem to find a solution that works.

I have a mail script:

Code: Select all

$to = 'someone@somewhere.com';
$subject = "You've got Mail!"; 
$message = 'This is a test Email';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Webmaster <do-not-reply@domain.com>' . "\r\n";
$sent = mail("$to", "$subject", "$message", "$headers") ;
This code is tried and tested on a UNIX server and sends to Hotmail accounts.

However, I had to change this:
$headers .= 'From: Webmaster <do-not-reply@domain.com>' . "\r\n";
to this:
$headers .= 'From: do-not-reply@domain.com' . "\r\n";
to even get mail() to work on my work IIS server, but it doesn't send to Hotmail accounts.

I thought that Hotmail may have blacklisted our work DNS settings, but I can send emails from my work email account to Hotmail account without any problems and IIS and MS Exchange on the same server. . . . .

Is there something else I can try or look for as this is doing my nut in?

Re: PHP Mail() on IIS problem

Posted: Wed May 19, 2010 4:54 am
by Benjamin
Swiftmailer is simple to integrate and much more powerful than the mail function. You would be better off using it, especially on a Windows box.

Re: PHP Mail() on IIS problem

Posted: Wed May 19, 2010 5:24 am
by koolsamule
Cool, cheers dude, checking it out now. Is this any better than PEAR Mail?

Re: PHP Mail() on IIS problem

Posted: Wed May 19, 2010 5:32 am
by Benjamin
Yes, very much so.