hello - I want to know if there is a option in php or .net to say from which ip address we can send out email. We have couple ip addresses on one of our servers and we don't want to send the emails from the default ip, instead we want to send them from the other ip. Thanks in advance.
A:
It is controlled by the operating system, not php.
Do you have a SMTP server you can use? That way you will be sure it isn't being sent from a webserver IP address.
Byron Whitlock
2010-08-02 22:19:46
+2
A:
PHP can't control the outgoing IP, since it's not acting as a mail server. the mail()
function simply connects to whatever SMTP server is specified in php.ini and hands the mail over for the SMTP server to handle.
You can certainly tell the SMTP server which IPs it should bind to, here's how for Postfix. If your website's on a.b.c.d
, you want emails to appear from e.f.g.h
, then tell Postfix (or whatever server you're using) bind to e.f.g.h
and 127.0.0.1
.
And of course, you could always run the SMTP software on a completely seperate server as well.
Marc B
2010-08-02 22:39:26