mail() return path

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
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

mail() return path

Post by icesolid »

I am using the code below to set headers for e-mail sent using mail(); Some of the e-mail clients do not pick up a Return-path. Instead when the user hits "Reply" in their e-mail client it loads nobody@host.sitename.com. Also could setting the priority of the message to high effect a users spam program in blocking out my message?

Code: Select all

$head = "From: support@sitename.com <support@sitename.com>\n" .
"Reply-to: support@sitename.com <support@sitename.com>\n" .
"Return-path: support@sitename.com <support@sitename.com>\n" .
"X-Priority: 1 (High)\n" .
"X-Mailer: PHP/" . phpversion() . "\n" .
"MIME-Version: 1.0\n" .
"Content-Type: multipart/mixed; boundary=\"$bound\"\n\n";
User avatar
vargadanis
Forum Contributor
Posts: 158
Joined: Sun Jun 01, 2008 3:48 am
Contact:

Re: mail() return path

Post by vargadanis »

I have not met anything like that before. I mean that the priority of the mails would block it.

In my projects I put the responsibilities of sending emails on the shoulders of a free project: phpmailer. Very handy...
Your code seems to be as it is supposed to be. The reason for the bad reply address is because the mail function is using an unathenticated (from your point of view) way of sending messages.
If you want to make sure that the emails are being sent from that address use imap_mail function or phpmailer.
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Re: mail() return path

Post by icesolid »

How will imap_mail() change anything? I just tried it instead of mail() and everything seems to look the same to me?
User avatar
vargadanis
Forum Contributor
Posts: 158
Joined: Sun Jun 01, 2008 3:48 am
Contact:

Re: mail() return path

Post by vargadanis »

Well, I don't know!
When I tried it it worked to me once, a long time ago. But I am telling you, PHPMailer can do SMTP auth which will send emails from the email address of the account you log into. Therefore this is the best choice. It uses fopen to open up a socket to the SMTP server directly and composes MIME mails that way.
Post Reply