title: sendmail: rewrite envelope info while travelling
body: <p>I run my own sendmail mail server at my office which has been functioning perfectly for years.</p>
  
  <p>I recently noticed that when travelling, my emails to friends are sometimes bounced - often due to the fact that IP address I am using is part of a range that are dynamically allocated by whichever ISP I happen to be using. These addresses often end up for one reason or another on a blacklist.</p>
  
  <p>My question is, does anyone know how I can get sendmail to rewrite the header information so that anything (especially from me using my email address) can be rewritten to look like it was sent from my own network (we have our own C class range). Effectively I want all my outgoing mail that goes through my mail server to look like it was sent physically from my office.</p>
  
  <p>To explain a little more clearly. When I am travelling, I am using my own email account which uses my own mail server as the SMTP host. It appears that when I am connected to the net via a dynamically allocated IP address and send email via my SMTP server, it gets rejected by the destination host. I was pretty sure I was using authentication to my server - I'll check when I'm able in a few hours.</p>
  
  <p>Addendum:</p>
  
  <p>Here are the headers for a typical rejection from gmail.com after I sent an email from my current location to my Google account via my SMTP server. Th e problem is being caused by the original "Received From" header.</p>
  
  <p>----- Transcript of session follows -----
  ... while talking to gmail-smtp-in.l.google.com.:</p>
  
  <pre><code>&gt;&gt;&gt; DATA
  &lt;&lt;&lt; 550-5.7.1 [203.217.18.80      12] Our system has detected that this message is
  &lt;&lt;&lt; 550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail,
  &lt;&lt;&lt; 550-5.7.1 this message has been blocked. Please visit
  &lt;&lt;&lt; 550-5.7.1 http://support.google.com/mail/bin/answer.py?hl=en&amp;answer=188131 for
  &lt;&lt;&lt; 550 5.7.1 more information. pp2si5211798pbb.61 - gsmtp
  554 5.0.0 Service unavailable
  
  &gt;--t157o6hX029609.1423122606/edrs.com.au
  &gt;Content-Type: message/delivery-status
  &gt;
  &gt;Reporting-MTA: dns; edrs.com.au
  &gt;Received-From-MTA: DNS; 58-6-171-5.dyn.iinet.net.au
  &gt;Arrival-Date: Thu, 5 Feb 2015 18:49:51 +1100
  &gt;
  &gt;Final-Recipient: RFC822; edrs.com.au@gmail.com
  &gt;Action: failed
  &gt;Status: 5.7.1
  &gt;Remote-MTA: DNS; gmail-smtp-in.l.google.com
  &gt;Diagnostic-Code: SMTP; 550-5.7.1 [203.217.18.80      12] Our system has detected that this &gt;message is
  &gt;Last-Attempt-Date: Thu, 5 Feb 2015 18:50:06 +1100
  
  &gt;--t157o6hX029609.1423122606/edrs.com.au
  &gt;Content-Type: message/rfc822
  &gt;Content-Transfer-Encoding: binary
  
  &gt;Return-Path: &lt;dna@edrs.com.au&gt;
  &gt;Received: from [192.168.0.166] (58-6-171-5.dyn.iinet.net.au [58.6.171.5])
      (authenticated bits=0)
      by edrs.com.au (8.13.8/8.13.8) with ESMTP id t157nohY029604
      (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO)
      for &lt;edrs.com.au@gmail.com&gt;; Thu, 5 Feb 2015 18:49:51 +1100
  &gt;Message-ID: &lt;54D3209E.6050702@edrs.com.au&gt;
  &gt;Date: Thu, 05 Feb 2015 17:49:50 +1000
  &gt;From: Nigel Allen &lt;dna@edrs.com.au&gt;
  &gt;User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
  &gt;MIME-Version: 1.0
  &gt;To: Nigel Allen &lt;edrs.com.au@gmail.com&gt;
  &gt;Subject: {SPAM?} Fwd: Re: Listener Issue: App installation or download
  &gt;References: &lt;54d1192bdcc4e_4688829e981572fd@help.tunein.com&gt;
  &gt;In-Reply-To: &lt;54d1192bdcc4e_4688829e981572fd@help.tunein.com&gt;
  &gt;X-Forwarded-Message-Id: &lt;54d1192bdcc4e_4688829e981572fd@help.tunein.com&gt;
  &gt;Content-Type: multipart/mixed; boundary="----------=_1423122599-19274-10"
  &gt;X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (edrs.com.au [203.32.74.10]); Thu, 05 Feb 2015 18:49:52 +1100 (AEDT)
  &gt;X-Spam-Score: 6.618 (******) &gt;AWL,BAYES_00,DNS_FROM_AHBL_RHSBL,HTML_MESSAGE,RCVD_IN_PBL,RCVD_IN_RP_RNBL,RDNS_DYNAMIC
  &gt;Content-Transfer-Encoding: binary
  &gt;X-Scanned-By: MIMEDefang 2.70 on 203.32.74.10
  </code></pre>