This post is below to "Postfix configuration" and here we "rewrite the from address" of all outgoing emails
- How to send no-reply@ email from postfix
- Send email with no-reply
- How to send email from postfix with noreply / no-reply
Postfix is sending an email with using the current logged in username @domain name, In this post we will "configure the postfix" for sending an email using [email protected]
Step 1st:
If file not exist then Create a canonical file that have a line to rewrite or replace all outgoing email to no-reply@domain
Open or Create a file, add below syntax and save
vi /etc/postfix/canonical
If we want to rewrite particular email with no-reply, use the following this format
#To rewrite all the email, use the following this format in canonical map file
/.*/ [email protected]
Step 2 -
Edit/re-reconfigure a postfix configuration file, I would suggest to create a backup of existing postfix configuration file before making a change.
Backup:
cp /etc/postfix/main,cf /etc/postfix/main.cf-`date -I`
A - Open Postfix Configuration file and append/add below configuration if you want rewrite particular email with no-reply ( [email protected] [email protected] )
vi /etc/postfix/canonical
OR
canonical_maps = hash:/etc/postfix/canonical
sender_canonical_maps = regexp:/etc/postfix/canonical
Thanks you !!
canonical_maps = hash:/etc/postfix/canonical
B - Open Postfix Configuration file and append/add below configuration if you want rewrite all the email with no-reply ( /.*/ [email protected] )
vi /etc/postfix/canonical
Step 3 - Update Postfix maps by executing the following command to create and update the canonical database
sudo postmap /etc/postfix/canonical
Step 4 - Reload Postfix service
systemctl reload postfix
Step 5 - Text & Enjoy
echo "Test no-reply" | mail -s "rewrite from address with no-reply" [email protected]
I hope this topic gave you all the information you needed. If you have any further questions or would like more detailed directions feel free to contact us using any of the following sources.We look forward to talking to you.