making php mail() use external smtp server

Red Squirrel

No Lifer
May 24, 2003
69,733
13,351
126
www.betteroff.ca
I have this custom mailing list script I made and it uses mail(). One thing is php mail() uses the local server as smtp. Lot of spam blockers will block that since it looks like its a spammer sending locally. I want to specify an external smtp server. How would I go about doing that? theres options in php.ini but for some reason its win32 only.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Why not just setup your local SMTP server to relay through your ISP's SMTP server?
 

Red Squirrel

No Lifer
May 24, 2003
69,733
13,351
126
www.betteroff.ca
Thats how its setup now, but I want to totaly bypass my local SMTP server. I had to recently change the way I send mail (used to do it locally) due to more and more spam filters looking for that, which really makes sense since lot of spammers probably setup their own servers.

A mail header right now shows that its been relayed through my local domain and my local internal IP. I don't want that, I want it to show up as either my ISPs, or my web host's. (probably my web host, for my case)

I'm thinking I need to use a sendmail argument to specify smtp, just not sure what.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
No SPAM filter that I know of cares where the first or any intermediary hops come from, just the server that's connecting directly to them to deliver the message.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0

Uhh, no.

SMTP string

Used under Windows only: host name or IP address of the SMTP server PHP should use for mail sent with the mail() function.
smtp_port int

Used under Windows only: Number of the port to connect to the server specified with the SMTP setting when sending mail with mail(); defaults to 25. Only available since PHP 4.3.0.

 

whoiswes

Senior member
Oct 4, 2002
850
0
76
sorry, didn't read that one thoroughly.

a few minutes on google found these:

create your own mail function, use that in place of built-in mail() => http://www.webmasterworld.com/forum40/1178.htm

use sendmail as a relay agent - this may or may not fit your needs for header modification => http://cri.ch/linux/docs/sk0009.html

personally I like the first - it's quick and easy and you KNOW it will work (provided you can hit your external SMTP system through a socket)

again, sorry for the oversight.