By spieriz
Hello!
I have a bit common problem, but I haven’t found any solution yet, after reading really a lot of forums and tutorials. Shortly: I want to send an email from external domain to my server, but it’s never recieved.
Server:
VPS with Ubuntu 16.04.
Followed tutorial:
https://www.digitalocean.com/communi...n-ubuntu-16-04 (and a lot of others after detecting problems, but that one was the main)
What I have / can do:
What I don’t have / can’t do:
What I try to do (but I can’t):
Postfix main.cf
# 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
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
myhostname = vps_name
mydomain = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 my_server_ip_address
mydestination = $myhostname, localhost, localhost.$mydomain, $mydomain
# 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_tls_cert_file=/etc/letsencrypt/live/example.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/example.com/privkey.pem
#smtpd_use_tls=yes
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
#smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
#smtpd_tls_protocols=!SSLv2
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_sender_restrictions = permit_sasl_authenticated
smtpd_relay_restrictions =
permit_mynetworks
permit_sasl_authenticated
permit_inet_interfaces
reject_unauth_destination
smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
permit_inet_interfaces
reject_unauth_destination
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
relayhost =
mailbox_command =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
myorigin = /etc/mailname
milter_protocol = 2
milter_default_action = accept
smtpd_milters = inet:localhost:12301
non_smtpd_milters = inet:localhost:12301
home_mailbox = Maildir/
virtual_alias_maps = hash:/etc/postfix/virtual
Port 25 listening:
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 32022/master tcp6 0 0 :::25 :::* LISTEN 32022/master
Additional info
When I’ll try to send email to my domain, I have non-delivery message:
Remote host said: 454 4.7.1 <admin@my_domain>: Relay access denied
If I’ll use mxtoolbox - ‘test email server’, the response is:
Connecting to MY_VPS_IP
220 VPS_NAME ESMTP Postfix (Ubuntu) [1126 ms]
EHLO keeper-us-east-1b.mxtoolbox.com
250-VPS_NAME
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN [705 ms]
MAIL FROM:<supertool@mxtoolbox.com>
250 2.1.0 Ok [687 ms]
RCPT TO:<test@mxtoolboxsmtpdiag.com>
554 5.7.1 <test@mxtoolboxsmtpdiag.com>: Relay access denied [690 ms]
LookupServer 8529ms
I spent a lot of hours trying to solve this problem and I failed. I will be very grateful for any advice what I’m doing wrong and how I can fix the problem.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
The error will usually occur when there is an issue with the Postfix configuration. You can backup your config file and then try a basic config file just for testing to check if this will provide different result
https://www.postfix.org/BASIC_CONFIGURATION_README.html
You can check our tutorial on # How To Set Up a Postfix E-Mail Server with Dovecot
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.