Difference between revisions of "Masquerade email address"

From Amahi Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
If you have followed [[Outgoing_mail_via_gmail|Outgoing main via Gmail]] or [[Enable_Outgoing_Emails|Enable Outgoing Emails]] tutorial, you will notice that the sending email address is not properly formed.  For example, it appears as root@hda.amahi.net vs root@amahi.net.  This can be easily changed with a minor update to Postfix.
+
If you have followed [[Outgoing_mail_via_gmail|Outgoing mail via Gmail]] or [[Enable_Outgoing_Emails|Enable Outgoing Emails]] tutorial, you will notice that the sending email address is not properly formed.  For example, it appears as root@hda.amahi.net vs root@amahi.net.  This can be easily changed with a minor update to Postfix.
  
 
You can force Postfix to send local emails with your preferred email address as the "sender" header.  This means that when you send mails using "mail" or mails automatically sent by root,you can get your email at the from field.
 
You can force Postfix to send local emails with your preferred email address as the "sender" header.  This means that when you send mails using "mail" or mails automatically sent by root,you can get your email at the from field.
  
 
* [[Open_Terminal_as_root|Open terminal as root]], create /etc/postfix/sender_canonical file:
 
* [[Open_Terminal_as_root|Open terminal as root]], create /etc/postfix/sender_canonical file:
{{code|vi /etc/postfix/sender_canonical}}
+
<pre>vi /etc/postfix/sender_canonical</pre>
  
 
* Create the /etc/postfix/sender_canonical, and add user -> email references like this:
 
* Create the /etc/postfix/sender_canonical, and add user -> email references like this:
{{text|root        admin@yourisp.com
+
<pre>root        admin@yourisp.com
logwatch    logwatch@yourisp.com}}
+
logwatch    logwatch@yourisp.com</pre>
  
  
 
* Create /etc/postfix/sender_canonical.db file:
 
* Create /etc/postfix/sender_canonical.db file:
{{code|postmap hash:/etc/postfix/sender_canonical}}
+
<pre>postmap hash:/etc/postfix/sender_canonical</pre>
  
 
* Add sender_canonical variable to /etc/postfix/main.cf:
 
* Add sender_canonical variable to /etc/postfix/main.cf:
{{code|postconf -e "sender_canonical_maps<nowiki>=</nowiki>hash:/etc/postfix/sender_canonical"}}
+
<pre>postconf -e "sender_canonical_maps<nowiki>=</nowiki>hash:/etc/postfix/sender_canonical"</pre>
  
 
* Restart postfix:
 
* Restart postfix:
{{code|systemctl restart postfix.service}}
+
<pre>systemctl restart postfix.service</pre>
  
  
 
REF:  [http://ubuntuforums.org/showthread.php?t=38429 Make Postfix rewrite sender header on local mails]
 
REF:  [http://ubuntuforums.org/showthread.php?t=38429 Make Postfix rewrite sender header on local mails]

Latest revision as of 02:18, 2 June 2020

If you have followed Outgoing mail via Gmail or Enable Outgoing Emails tutorial, you will notice that the sending email address is not properly formed. For example, it appears as root@hda.amahi.net vs root@amahi.net. This can be easily changed with a minor update to Postfix.

You can force Postfix to send local emails with your preferred email address as the "sender" header. This means that when you send mails using "mail" or mails automatically sent by root,you can get your email at the from field.

vi /etc/postfix/sender_canonical
  • Create the /etc/postfix/sender_canonical, and add user -> email references like this:
root         admin@yourisp.com
logwatch     logwatch@yourisp.com


  • Create /etc/postfix/sender_canonical.db file:
postmap hash:/etc/postfix/sender_canonical
  • Add sender_canonical variable to /etc/postfix/main.cf:
postconf -e "sender_canonical_maps=hash:/etc/postfix/sender_canonical"
  • Restart postfix:
systemctl restart postfix.service


REF: Make Postfix rewrite sender header on local mails