Hi all:

I am running PHP on IIS7. I use 2 different mail servers, one for bulk mail on my VPS and one for single emails on a shared mail server.

The problem I am having is using PHP Mail I need to set the PHP.ini SMTP to my IP address. This is fine for my bulk emails, but I have no way now to send an email through my shared mail server. Or I could set the SMTP in PHP.ini to the shared server and not be able to send through my bulk mail server.

I am coming out of ASP Classic and switching to PHP. With ASP Classic I used to use CDOSYS. One of the configuration lines in the CDOSYS email itself is as follows:

I would use the following for single emails

myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail.mysite.com"

And the following for bulk emails

myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail2.mysite.com"

So my question is, can I specify the SMTP option directly in my PHP email INSTEAD of in PHP.ini so I can decide which server I want to use per email script and not globally?

Thank you

    Think I found my own answer

    ini_set('SMTP', 'mail.mysite.com');
    ini_set('SMTP', 'mail2.mysite.com');

      recommend you switch to a third pary library over php's own mail() command a lot more power, faster and more options.

        Is there one you would recommend? It needs to work with IIS7.

          Thank you. I downloaded phpmailer!

            Write a Reply...