Machine name in email return path


#1

I have discovered that email sent through my website contact form, and via the phpBB forums installed on my site has the following headers:

Return-Path: username@scotch.dreamhost.com
Delivered-To: username@spork.dreamhost.com

This is causing some servers, like Hotmail and Apples .Mac mail to block these emails, meaning that my visitors don’t get confirmation emails or activation email on the forums.

Is there any way to change these values? If I supply the headers when the emails are sent, will it override the defaults added by Dreamhost? I have no idea how I would do this with phpBB, but I need to know if supplying the headers myself will work before I start poking in the phpBB innards.

Any help much appreciated.

Richard Smith
Drawing Business


#2

Search for “envelope-sender” in the forums.

Basically, if the program is using sendmail, add:
-fuser@example.com

to the call to Sendmail.

With PHP’s mail() function, this is done by setting the last (5th, I think) parameter to the function (“arguments to sendmail”) to "-fuser@example.com".


#3

“Basically, if the program is using sendmail, add:
-fuser@example.com

Sorry to be dense, but does that mean an “-f” switch followed by "user@example.com"?

So my script would use:
open MAILOUT, “|/usr/sbin/sendmail -t -f user@example.com”?

Here’s hoping to be spoon fed. I’ve been Googling for Sendmail help, but no joy (it’s all about configuring sendmail, not using it).

Richard Smith
Drawing Business


#4

Something like:
open MAILOUT, “|/usr/sbin/sendmail -t -fuser@example.com

It might work with a space too.


#5

open MAILOUT, “|/usr/sbin/sendmail -t -fuser@example.com

Damned Hotmail! This works as expected (thanks), and adds the correct “Return-path” header to the outgoing messages, but my test emails still don’t make it though to my Hotmail Inbox.

I have used "webmaster@drawingbusiness.com" in replace of user@example.com - should the user name be the same as the address I use in the “From:” or “Reply-to:” header?

Richard Smith
Drawing Business


#6

Well my point wasn’t that doing this would fix your hotmail problem - just that if hotmail were rejecting the messages, you’d be receiving the bounces (you would be receiving them if the envelope-sender were user@machine.dreamhost.com too - it would be going to the mailbox for that user - it’s mostly in the case of mod_php where it’s especially important to set this, since in that case, it’s the Apache user that’s sending the message).

So anyway, my point is that you should make sure that the messages aren’t getting rejected by hotmail.

If the messages aren’t being rejected and aren’t showing up in the junk mail folder, there’s not a whole lot that we can do. It’s generally a bad idea (in my opinion) to just silently drop mail, but some sites seem to do it.

Just out of curiosity, if you do:

echo ‘blah’ | mail -s ‘test’ [address]@hotmail.com
(replacing [address] with the person’s hotmail address, of course) they you receive the message?

If you don’t already have one, you may want to setup a test hotmail account for the purposes of testing.

If you submit a support request with an example of a hotmail user that’s not receiving the message, I can take a look in the logs, but I’m pretty sure they’re not explicitly rejecting mail from our machines.

It should be a valid address you check, but don’t mind getting lots of bounces to.

Note that in this case of any sort of bulk mail, we require that you set a valid return-path and remove any addresses which bounce permanently more than a few times.


#7

I have a Hotmail account I have been using for testing. I have been using this account to submit test messages to myself through my contact form. Whenever this form is used, the visitors comments are sent to me at my main account address, and a “thank you for contacting me” email is sent to the visitor. In all cases, I have recieved the comments submitted via the form, but if I use my Hotmail account in my test mails, I do not receive the “Thank you” message, and I get no bounced or message back from Hotmail.

The same has occured with users of my forums. If they attempt to register using a Hotmail account, then they recieve no email, and I get no failure reports. It just “silently fails”. Using a “paid” account to register works as expected.

[quote]Just out of curiosity, if you do:

echo ‘blah’ | mail -s ‘test’ [address]@hotmail.com
(replacing [address] with the person’s hotmail address, of course) they you receive the message?[/quote]
I assumed this should be done from the command line after connecting using ssh. I copied and pasted the command, substituting my own Hotmail address. The server did not return any error, but there was no message delivered to my Hotmail account, and no bounce either.

I read about similar problems on the phpBB support forums (http://www.phpbb.com/phpBB/viewtopic.php?t=211974), and it is reported there that “Sometimes yahoo, hotmail, and other free providers filter out mails from unknown domains or domains set up on servers with virtual hosting”. I was hoping that this was a known issue, and that there would be a way round the problem.

As far as I can tell, the phpBB script correctly sets the ‘Return-Path’ header to "webmaster@drawingbusiness.com", but the emails from my forum have "user@machine.dreamhost.com" as the ‘Return-Path’.

Richard Smith
Drawing Business


#8

Are you /sure/ you’ve doublechecked your junk mail settings and checked the junk mail folder?

My test took a little while (hotmail has a lot of inbound MXs, and most of them refuse connections a lot of the time, so the server that mail to hotmail goes through gets backed up), but it got there. It did end up in my junk mail folder, though. You may need to have people whitelist you.


#9

Wow! More than 2 hours after I sent it, the messages have started arriving in my Junk folder. Unbelievable.

Hard to bug hunt when you have to wait several hours to find out if the fix worked!

Is there any way to stop the Dreamhost server overriding the ‘return-path’ header set by the phpBB scripts? That might stop the messages going into the Junk folder.

Richard Smith
Drawing Business


#10

What do you mean? We’re not overriding it - phpBB isn’t setting it at all.

It may have a configurable option to let you set it, or you may have to hack the source (if they’re using php’s mail() function, you can do it as I outlined.

Again, though, I don’t think this is the reason your messages are being filtered to the junk folder. I simply suggested setting it because /if/ hotmail is / was rejecting messages, you’d want to make sure you’re getting the bounces.