PHP Mail() on IIS problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
koolsamule
Forum Contributor
Posts: 130
Joined: Fri Sep 25, 2009 10:03 am

PHP Mail() on IIS problem

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: PHP Mail() on IIS problem

Post 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.
koolsamule
Forum Contributor
Posts: 130
Joined: Fri Sep 25, 2009 10:03 am

Re: PHP Mail() on IIS problem

Post by koolsamule »

Cool, cheers dude, checking it out now. Is this any better than PEAR Mail?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: PHP Mail() on IIS problem

Post by Benjamin »

Yes, very much so.
Post Reply