Modify Sendmail return_path header

sendmail

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?

Update:

Here are the contents of /etc/mail:

access
access.db
domaintable
domaintable.db
helpfile
local-host-names
mailertable
mailertable.db
Makefile
sendmail.cf
sendmail.cf.orig
sendmail.cf.rpmnew
sendmail.mc
submit.cf
submit.mc
trusted-users
virtusertable
virtusertable.db

Best Answer

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)