Changing outgoing SMTP email on Postfix MTA.

 

Most of the time, email servers rejects emails coming from a VPS, mainly because the sending email address does not validate against authorized mail servers registered on your DNS records. That is, your VPS assign each local users its own name with the added extension corresponding to the hostname of the VPS.

 

The result on the outgoing email address will be the internal username plus the hostname assigned to the local VPS, which in turn will not correspond to the real domain being used for the mail transfer.

 

To overcome this problem we need to change the outgoing mail address or masquerade it with the real domain you use as the default outgoing email, hiding instead the original internal email address.

For example:

SMTP User:Adam

Email ID: Adam@domain,com

Server name: server3.vpshosting.com

 

On this scenario, when Adam sends an email, the outgoing mail id would be [email protected], which is not a real domain.

In most cases internal hosts have no valid Internet domain name, and instead use a name such as localdomain.local. The result will be a rejected email by the recipient’s mail server sending it to the spam folder.

 

Postfix MTA offers smtp_generic_maps parameter. You can specify lookup tables that replace local mail addresses by valid Internet addresses when mail is being sent by the VPS via SMTP.

Open your main.cf file
# vi /etc/postfix/main.cf

Append the following parameter
smtp_generic_maps = hash:/etc/postfix/generic

Save and close the file. Open /etc/postfix/generic file:
# vi /etc/postfix/generic

Make sure Adam@server3.vpshosting.com change to [email protected]
[email protected] [email protected]

Save and close the file. Create or update generic postfix table:
# postmap /etc/postfix/generic

Restart postfix:
# /etc/init.d/postfix restart

This will solve the problem by replacing your internal mail address with the masqueraded one: [email protected]

 

 

Test on a Miami VPS Now

or

Deploy on a Miami Dedicated Server

Was this answer helpful? 13 Users Found This Useful (59 Votes)