The best thing here is to set up a header filter that replaces first From: 
header with your adress, and first To: header with the destination gmail adress.
To prevent that any spam blacklisted adresses appear, discard every to: and cc: 
header after this.
Then you ensure the MAIL FROM in the SMTP communication with gmail, states your 
adress and not Yahoo’s. Add a SPF record to your domain, and then you are done.

If you want to go the encapsulation way, it gets a little bit more complicated, 
and you need some sort of milter or post-processing filter to encapsulate the 
email.

From: Il Neofita 
Sent: Thursday, September 17, 2015 8:12 PM
To: Sebastian Nielsen 
Cc: postfix-users@postfix.org 
Subject: Re: Forward rejected by yahoo

Thank you very much for the fast reply.

I was looking on sieve or postfix and I do not find how I can do it.

Since I believe that will be the best way to do it.

Can you help me out?


Thank you



On Thu, Sep 17, 2015 at 1:51 PM, Sebastian Nielsen <sebast...@sebbe.eu> wrote:

  No.
  SPF is designed to be secure, eg you cannot add some header to bypass the 
authentication, then every phisher would add such a header.

  What you need to do, is to rewrite the FROM adress or encapsulate the email.
  Rewriting FROM adress can be as simple as rewriting yourn...@yahoo.com to 
yourn...@yourserver.tld , or even yourname.yahoo....@yourserver.tld
  Then you host a own SPF record.
  The disadvantage of this method, is that it will not be possible to reply or 
answer on emails from your google account. You could however, since you know 
the domain and username, manually write the correct @yahoo.com adress in the 
“to” field when replying to a email.

  Another way, is to encapsulate the email in a new message/rfc822 container, 
where the outer container contains like From: forwar...@yourserver.tld To: 
somen...@gmail.com , Subject: Fwd: Original Subject
  And then the inner container contains:
  From: yourn...@yahoo.com
  To: yourn...@yourserver.tld
  Subject: Original Subject

  The advantage with this method is that you can reply to the email by replying 
to the inner container. This is how most email clients forward email, by 
encapsulating them.
  In most cases, a email client will either show a iframe showing the original 
content, a button to open the mail in a new window, or a attached file that can 
be opened to show the mail.

  Of course, its important that you do publish a own SPF record.
  And also, its a bad idea to forward spoofed email, since this could get your 
domain “blacklisted” at google, thus its a good idea to SPF and/or DKIM check 
any incoming email on your forwarder adress before forwarding them.

  From: Il Neofita 
  Sent: Thursday, September 17, 2015 7:40 PM
  To: postfix-users@postfix.org 
  Subject: Forward rejected by yahoo

  Hi,

  I have the following problem if I forward an email received from yahoo to an 
other yahoo account the message is rejected.

  If I send a message from yahoo -> my server and forwarded to a google account 
the message is marked as spam, since is considered a spoofed.


  Can I fixed this adding some header?


  Thank you

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to