Server Fault Asked on December 18, 2021
So I finally managed to set up a Postfix+Dovecot+Roundcube mailserver on a new Ubuntu 18.04 server with the help of ServerFault and a bunch of how-to blogs online and I can send/receive email from the server now.
Now that I’m sure that the mailserver is working, what should I do to make a webserver that I already have (Ubuntu 18.04) to send emails using that mailserver? (I don’t really need to receive emails on the webserver as I can just add a subdomain for each site that points to the mailserver).
There’s articles online mentioning SMTP authentication (smtp auth
to be specific), open relays, etc but I’m not sure how do I go about it and didn’t want to fiddle too much with the webserver as it has live sites and I’m worried that I might screw up.
Mailserver Postfix Configuration:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = localhost.$mydomain, localhost, localhost.localdomain
myhostname = abc.exampleDomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/letsencrypt/live/exampleDomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/exampleDomain.com/privkey.pem
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_mailbox_domains = /etc/postfix/virtual_mailbox_domains
virtual_transport = lmtp:unix:private/dovecot-lmtp
Mailserver master.cf:
smtp inet n - y - - smtpd
submission inet n - y - - smtpd
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
smtps inet n - n - - smtpd
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
I couldn't comment, so hopefully this will help.
I recently had a similar issue, so please see this post I recently made:
Send mail via port 465 or 587 on Google Cloud VM / Postfix
Have you also tried changing your MX record on your DNS record to point to your mailservers domain?
Answered by SW_Cali on December 18, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP