Issue with php mail

Red Squirrel

No Lifer
May 24, 2003
69,164
12,965
126
www.anyf.ca
This is very odd. I noticed that when I send using php mail() even if I set a reply-to and from header, the server sends from apache@myhostname.com. But yet if I send to a valid address and get the email it looks like it comes from right host. when I send to an invalid host, that's where it messes up, since the bounce back goes to apache@myhostname.com instead of what I specified in the from and reply-to. What would cause this?
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
I really don't recomend using the built in mail function if you can help it. I'd try pear::mail
 

Red Squirrel

No Lifer
May 24, 2003
69,164
12,965
126
www.anyf.ca
Should I just use sockets and open smtp connection directly? I've thought of doing that too, this way I can actually output the server response somewhere (the user, or a log). I'll check out pear::mail as well.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: RedSquirrel
Should I just use sockets and open smtp connection directly? I've thought of doing that too, this way I can actually output the server response somewhere (the user, or a log). I'll check out pear::mail as well.

NO point in reinventing the wheel, just use pear:mail or something like phpmimemail
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
pear::mail + pear::email_mine makes it so easy to build html messages with attachments it's not even funny.

And it can do raw smtp if you want it to.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Should I just use sockets and open smtp connection directly?

No, you should never build something from scratch when a usable alternative already exists. Chances are pretty good that the other people have been looking at it longer than you and have thought of things, run into problems, etc that you haven't yet.
 

Red Squirrel

No Lifer
May 24, 2003
69,164
12,965
126
www.anyf.ca
I just gave pear mail a try but I'm at lost at how to install it. I thought I could just drop the folder in my project and include Mail.php but that file includes PEAR.php which I can't find anywhere in that package. I checked their site and it mentions using the "pear" command but no such command exists nor is there an executable that comes with it, so I'm at loss.