7

I often see email headers like these when I get email these days:

Received: by FQDN (Postfix, from userid $USERID)

So does that mean that people SSH into their VPS and send email from there or is there a way of relaying email from my local computer through the VPS?

Basically, I want to do the same to hide my IP address when I send an email through SMTP and want to use the VPS address instead.

user
  • 28,901
Kasey
  • 71
  • 3
    What MTA are you using? Why would it be relevant that you are talking about a VPS? Are you sure this isn't simply what Spamcop calls an "internal handoff"? Normally the MTA will include the IP address of the connecting host, and this is recommended by the standard; see RFC 5321 section 4.4 (Trace Information). – user May 20 '13 at 07:42

4 Answers4

1

Assuming you have relaying via your VPS working, if you'd like to remove some headers from emails relayed via Postfix it's fairly straightforward.

  1. Create a new file called /etc/postfix/header_checks with the following contents:

    /^Received:.*with ESMTPSA/              IGNORE
    
  2. Rebuild the lookup table:

    # postmap /etc/postfix/header_checks
    
  3. Edit /etc/postfix/main.cf and add the following line:

    smtp_header_checks = regexp:/etc/postfix/header_checks
    
  4. Restart postfix (assuming Debian/Ubuntu here):

    # /etc/init.d/postfix restart
    

When you send an email now, you should see all but the last Received header removed.

mjturner
  • 7,300
0

Two ideas:

Setup a proxy on the VPS (use SSH port forwarding, nc, or some type of SMTP forwarder that doesn't add received headers).

Write a program that runs on the VPS, have it take the emails from your and then inject the email locally (using sendmail/postfix from the command line or have it connect to localhost port 25).

Walter
  • 389
0

The best way to understand this is to try to send mail yourself using different methods.

I have found that the UID changes based on two factors (but there may be more).

  1. If the script uses the sendmail binary then it will reflect the UID of the user that invoked the script.
  2. If the script directly connects using SMTP it'll use the UID of the MTA.
  • I am not concerned about the UID at all, what I want to know is what is the "usual" way of sending email that have the headers matched above. – Kasey May 20 '13 at 03:34
-1

These headers are put in automatically by the servers the mail touches while making it's way tot he destination. If you want your VPS's server name to appear, you should use your VPS as the "smart relay" in your local mail configuration. With sendmail, this is done via the SMART_HOST definition in the /etc/mail/sendmail.cf file. You'll then need to ensure that your VPS is relaying mail properly, only from you, and isn't on any sort of blacklist (which is quite common for VPSes in my experience). Alternately, you can use your VPS as your mail host and simply connect to it via IMAP, instead of having a local MTA.

John
  • 17,011