Tuesday, December 29, 2015
How to rewrite outgoing email address in sendmail
We can edit the file below to rewrite outgoing email address.
/etc/mail/genericstable
Add the line below
youraccount [email protected]
regenerate the hash file
makemap -r hash genericstable.db < genericstable
You can also edit /etc/mail/aliases for local accout
Alias to your alias account
youraccount youaliasaccount
Or alias to your device
youraccount /dev/yourdevice
Remeber use newaliases to update the hash file
How to disable IPv6 in Postfix
If you send mail to gmail server without correct PTR records, you'll get the reject message below.
"message does not meet IPv6 sending guidelines regarding PTR records 550-5.7.1"
You may update PTR record, or disable IPv6 if you don't need it.
Edit main.cf
Update the value with ipv4 in this line "inet_protocols = all"
inet_protocols = ipv4
You might get another message "config variable inet_interfaces: host not found: [::1]"
Update the value with 127.0.0.1 in this line "inet_interfaces = 127.0.0.1, [::1]" will solve the problem.
"message does not meet IPv6 sending guidelines regarding PTR records 550-5.7.1"
You may update PTR record, or disable IPv6 if you don't need it.
Edit main.cf
Update the value with ipv4 in this line "inet_protocols = all"
inet_protocols = ipv4
You might get another message "config variable inet_interfaces: host not found: [::1]"
How to rewrite outgoing email address
When we call mail function by php on Linux , we can use postfix.
However, the sender will be always apache or www-data, since the system use default web user name as the sender name.
We can rewrite email of the sender by steps below.
Step 1
Check configuration in php.ini
[mail function]
; For Win32 only.
SMTP = localhost
; For Win32 only.
;sendmail_from = ***@yourdomain.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =\r
Step 2
Edit main.cf for postfix
vi /etc/postfix/main.cf
Step 3
Specify the generic map file in main.cf
smtp_generic_maps = hash:/etc/postfix/generic
Step 4
Edit generic file
vi /etc/postfix/generic
Step 5
[email protected] [email protected]
Step 6
Create postfix db hash file
postmap /etc/postfix/generic
Step 7
Restart postfix
/etc/init.d/postfix restart
You will need use sender_canonical_maps = hash:/etc/postfix/canonical instead if your postfix is earlier version.
However, the sender will be always apache or www-data, since the system use default web user name as the sender name.
We can rewrite email of the sender by steps below.
Step 1
Check configuration in php.ini
[mail function]
; For Win32 only.
SMTP = localhost
; For Win32 only.
;sendmail_from = ***@yourdomain.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =\r
Step 2
Edit main.cf for postfix
vi /etc/postfix/main.cf
Step 3
Specify the generic map file in main.cf
Step 4
Edit generic file
vi /etc/postfix/generic
Step 5
Specify the mapping address
[email protected] [email protected]
Step 6
postmap /etc/postfix/generic
Step 7
Restart postfix
/etc/init.d/postfix restart
You will need use sender_canonical_maps = hash:/etc/postfix/canonical instead if your postfix is earlier version.
Subscribe to:
Posts (Atom)