I'm hosting a portion of a website for a client, and sending e-mails from their primary domain from a server in my network. Proper SPF records are in place for this, but SPF checking is still failing.

SPF seems to be checking the Return-Path: header, which is currently showing up as serverusername@serverhostname. The server hostname uses an internal tld and means nothing to the outside world. The mail sending script is written in perl, and I tried passing a different return path value to sendmail via the -f flag, and also by explicitly adding a Return-Path: header. Both methods have resulted in no change to the Return-Path:.

How can I change the Return-Path: in sendmail to the from e-mail address of the e-mail I'm sending so SPF passes?


Here are the contents of /etc/mail:

  • Do you know which mail relaying server you are using? Qmail, postfix, something else? – WerkkreW Apr 9 '12 at 18:51
  • This box only has sendmail setup. – noctorum Apr 9 '12 at 18:59
  • There has to be an underlying mail server, which needs to be configured. – WerkkreW Apr 9 '12 at 19:00
  • There are no init scripts for postfix, qmail, exim etc., but mail is being sent out successfully with just sendmail. I'll update my main question with a list of the configuration files available in /etc/mail. – noctorum Apr 9 '12 at 19:03
  • That's really odd, maybe I have no idea what I'm talking about! Take a look in sendmail.cf to see if the configuration for the sender domains, return paths, etc are in there. – WerkkreW Apr 9 '12 at 19:08

From the bat book (page 1165):

The Return-Path: header is intended to show the envelope address of the real sender as opposed to the sender used for replying (the From: and Reply-To: headers). In posting Usenet news, for example, the Return-Path: shows “news” and the From: shows the address of the posting user. But in general, Return-Path: should never be used for replying to mail. It is intended to be used solely for notification of delivery errors.

You cannot change Return-Path: the way you try. Have your script submit emails to your mail server via SMTP. Or you can try FEATURE(masquerade_envelope)

  • This was resolved using masquerading. – noctorum Apr 10 '12 at 16:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.