Domain DNS Configuration
domain1.com. 3600 IN MX 10 mail.domain1.com.
domain1.com. 3600 IN TXT "v=spf1 a mx include:_spf.google.com -all"
POSTFIX Configuration
/etc/postfix/virtual
[email protected] [email protected]
[email protected] [email protected]
/etc/postfix/main.cf
mydomain = domain1.com
myhostname = mail.$mydomain
myorigin = $mydomain
mydestination =
relayhost =
virtual_alias_domains = $mydomain
virtual_alias_maps = hash:/etc/postfix/virtual
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
GMAIL Configuration
Visit https://myaccount.google.com/signinoptions/two-step-verification to enabled Gmail's Two-Factor Authentication
Visit https://myaccount.google.com/apppasswords
Select app : Mail
Select device : Other (custom name)
Input : [email protected]
Copy the generated password to the clipboard for further use
Gmail > Settings > Accounts and Import > Send mail as > Add another email address
Name : enter the name that you want your email to be seen as "From"
Email address : [email protected]
Treat as an alias : unchecked (if you prefer the recipient to reply directly to your Gmail address, then leave this checked)
Click "Next Step"
SMTP Server : smtp.gmail.com
Port : 587
Username : enter the portion of your Gmail address without the gmail.com part
Password : paste from the clipboard the generated password in https://myaccount.google.com/apppasswords
Secured connection using TLS : checked
Click "Add Account"
You will receive a verification code that confirms you are the owner of the email address you are attempting to "Send Mail As"
Once it arrives, copy and paste the verification code at the prompt you received in the previous step
Once done, go back to the email and click the link to "confirm the request"
When I send emails from [email protected] as [email protected] to [email protected] I got:
Be careful with this message
Gmail could not verify that it actually came from domain1.com. Avoid clicking links, downloading attachments, or replying with personal information.
How to avoid this warning?