Question

Can not send or receive email on my cento7 postfix server

I setup my mail server based on postfix on cento7 server. when I use online checking tools everything works fine with no errors.Local mail send test runs ok too, but I still can not receive/send mail unless I edit add 0.0.0.0/0 to mynetwork line lie this: mynetworks = , 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 X.X.X.X/29 0.0.0.0/0 X.X.X.X/29 this is the subnet of my server I know I should not do that but I can not find my way out. please help! here is my 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

smtpd_banner = $myhostname ESMTP $mail_name (CentOS) 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/letsencrypt/live/myserver.com/fullchain.pem smtpd_tls_key_file=/etc/letsencrypt/live/myserver.com/privkey.pem smtpd_use_tls=yes smtpd_tls_auth_only = yes smtp_tls_security_level = may smtpd_tls_security_level = may smtpd_sasl_security_options = noanonymous, noplaintext smtpd_sasl_tls_security_options = noanonymous

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 smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtpd_sender_restrictions = reject_unknown_sender_domain myhostname = myserver.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydomain = myserver.com myorigin = $mydomain mydestination = $mydomain, localhost, mail, mail.$mydomain relayhost = mynetworks = , 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 X.X.X.X/29 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all

Handing off local delivery to Dovecot’s LMTP, and telling it where to store mail

virtual_transport = lmtp:unix:private/dovecot-lmtp

Virtual domains, users, and aliases

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf, mysql:/etc/postfix/mysql-virtual-email2email.cf


Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
August 24, 2023

Heya,

Checking the logs, you can see the following errors after some messages:

:25: Connection timed out

port 25 is closed for external use. There are a few ways to go about the problem

  • try using ports like 465 or 587 for SMTP
  • use a third party solution only for your E-mails. Good examples are sendgrid.

To expand more on blocking port 25 for new accounts, this is something DigitalOcean has been doing to reduce spam on it’s network. It is more that we simply cannot accurately determine who is going to send it.

Stopping spam is a constant fight, so DigitalOcean has implemented some restrictions on newer accounts. Having said that, you can always contact them and ask for the port block to be lifted on:

https://www.digitalocean.com/support/

More information here:

https://docs.digitalocean.com/support/why-is-smtp-blocked/

Hope that helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel