-1

Have postfix 2.10. Nondefault options in main.cf:

smtp_header_checks = pcre:/etc/postfix/smtp_header_checks
relayhost = smtp.company.org

/etc/postfix/smtp_header_checks :

/from:.*/i REPLACE From: somebody@yahoo.co.uk

However, tcpdump shows that the following line sent to the relay:

MAIL FROM:<root@myserver.localdomain>

I'm sending it with local sendmail

basin
  • 558
  • 1
  • 5
  • 22
  • Check this http://serverfault.com/questions/724576/fully-altering-recipient-on-postfix/724890#724890 – ETL Sep 25 '15 at 20:25
  • @ETL I'm sending with local sendmail; updated the question – basin Sep 25 '15 at 20:47
  • The address in `MAIL FROM` is envelope address, the address in `From:` header is header address. Which one did you want to rewrite? http://stackoverflow.com/questions/1750194/why-does-email-need-an-envelope-and-what-does-the-envelope-mean – masegaloeh Sep 26 '15 at 04:02

1 Answers1

1

I like generic maps for this task, but besides that you can't send from yahoo this way.

postconf -e smtp_generic_maps=hash:/etc/postfix/generic
echo 'root icantsendfrom@yahoo.co.uk' >> /etc/postfix/generic
postmap /etc/postfix/generic
service postfix restart

to send from yahoo.

postconf -e relayhost=smtp.yahoo.co.uk:465 
echo 'smtp.yahoo.co.uk username:password' >>/etc/postfix/sasl_passwd
chown root:root /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd 
postmap hash:/etc/postfix/sasl_passwd

if postfix is installed, you are using it even if you run the sendmail command one one or the other can be installed, postfix will install a sendmail wrapper.

Jacob Evans
  • 7,886
  • 3
  • 29
  • 57