As google cloud don't allow sending emails from VMs port 25 is blocked, I am using third party service Mailjet to with VM to send email, I am using docker container to install postfix and test working of Mailjet .
- Configured relay with Postfix successfully using this google documentation
- Able to send an email using
echo 'Test passed.' | mail -s Test-Email EMAIL@EXAMPLE.COM
, Mail is recived by Mailjet .
Problem
*When sending test mail echo 'Test passed.' | mail -s Test-Email username@gmail.com
mail is sent to Mailjet
problem is it is sent using root@mydomain.com
, which Mailjet is asking me to confirm, I configured support@mydomain.com in Mailjet want same support@mydomain.com in place of root@mydomain.com, Tried many solutions didn't work ,
Want to change sending address root@mydomain.com = support@mydomain.com*
Attached Configuration and Logs
/var/log/mail.log
May 14 17:57:38 mydomain postfix/qmgr[1446]: 891A3199F: removed
May 14 18:04:51 mydomain postfix[2587]: Postfix is running with backwards-compatible default settings
May 14 18:04:51 mydomain postfix[2587]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:51 mydomain postfix[2587]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:51 mydomain postfix/postfix-script[2593]: fatal: the Postfix mail system is already running
May 14 18:04:58 mydomain postfix[2709]: Postfix is running with backwards-compatible default settings
May 14 18:04:58 mydomain postfix[2709]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:58 mydomain postfix[2709]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:58 mydomain postfix/postfix-script[2715]: fatal: the Postfix mail system is already running
May 14 18:05:17 mydomain postfix[2831]: Postfix is running with backwards-compatible default settings
May 14 18:05:17 mydomain postfix[2831]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:05:17 mydomain postfix[2831]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:05:17 mydomain postfix/postfix-script[2837]: fatal: the Postfix mail system is already running
May 14 18:05:30 mydomain postfix/pickup[1445]: 4506C2086: uid=0 from=<root@mydomain.com>
May 14 18:05:30 mydomain postfix/cleanup[2845]: 4506C2086: message-id=<20180514180530.4506C2086@mydomain.com>
May 14 18:05:30 mydomain postfix/qmgr[1446]: 4506C2086: from=<root@mydomain.com>, size=352, nrcpt=1 (queue active)
May 14 18:05:30 mydomain postfix/smtp[2847]: warning: database /etc/postfix/generic.db is older than source file /etc/postfix/generic
May 14 18:05:31 mydomain postfix/smtp[2847]: 4506C2086: to=<username@gmail.com>, relay=in.mailjet.com[104.xxx.xx.xx]:2525, delay=1.7, delays=0.02/0.01/1.3/0.33, dsn=2.0.0, status=sent (250 OK queued as 64ced0eb-ab23-498b-be32-2c267c128ce4)
May 14 18:05:31 mydomain postfix/qmgr[1446]: 4506C2086: removed
grep postfix /var/log/syslog
May 14 17:57:38 mydomain postfix/qmgr[1446]: 891A3199F: removed
May 14 18:04:51 mydomain postfix[2587]: Postfix is running with backwards-compatible default settings
May 14 18:04:51 mydomain postfix[2587]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:51 mydomain postfix[2587]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:51 mydomain postfix/postfix-script[2593]: fatal: the Postfix mail system is already running
May 14 18:04:58 mydomain postfix[2709]: Postfix is running with backwards-compatible default settings
May 14 18:04:58 mydomain postfix[2709]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:58 mydomain postfix[2709]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:58 mydomain postfix/postfix-script[2715]: fatal: the Postfix mail system is already running
May 14 18:05:17 mydomain postfix[2831]: Postfix is running with backwards-compatible default settings
May 14 18:05:17 mydomain postfix[2831]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:05:17 mydomain postfix[2831]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:05:17 mydomain postfix/postfix-script[2837]: fatal: the Postfix mail system is already running
May 14 18:05:30 mydomain postfix/pickup[1445]: 4506C2086: uid=0 from=<root@mydomain.com>
May 14 18:05:30 mydomain postfix/cleanup[2845]: 4506C2086: message-id=<20180514180530.4506C2086@mydomain.com>
May 14 18:05:30 mydomain postfix/qmgr[1446]: 4506C2086: from=<root@mydomain.com>, size=352, nrcpt=1 (queue active)
May 14 18:05:30 mydomain postfix/smtp[2847]: warning: database /etc/postfix/generic.db is older than source file /etc/postfix/generic
May 14 18:05:31 mydomain postfix/smtp[2847]: 4506C2086: to=<username@gmail.com>, relay=in.mailjet.com[104.199.96.85]:2525, delay=1.7, delays=0.02/0.01/1.3/0.33, dsn=2.0.0, status=sent (250 OK queued as 64ced0eb-ab23-498b-be32-2c267c128ce4)
May 14 18:05:31 mydomain postfix/qmgr[1446]: 4506C2086: removed
cat /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
virtual_alias_maps = hash:/etc/postfix/virtual
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, mydomain.com, localhost.com, localhost
relayhost = in.mailjet.com:2525
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
#default_transport = error
#relay_transport = error
inet_protocols = all
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_generic_maps = hash:/etc/postfix/generic
cat /etc/aliases
# See man 5 aliases for format
postmaster: root
root: support@mydomain.com
cat /etc/mailname
mydomain.com
I am new to postfix configuration after trying many solution not able to find soultion thanks for any help.