How do I config postfix to accept sending email from gitlab installed on a subdomain?

Hi, I have a postfix installed on I installed gitlab on and I have configured gitlab to send email through my postfix. here is my gitlab.rb:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = ""
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "root"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_domain'] = ""
gitlab_rails['smtp_authentication'] = :plain
gitlab_rails['smtp_enable_starttls_auto'] = true

But I get this error on postfix log file:

example postfix/smtpd[26413]: connect from[]
example postfix/smtpd[26413]: lost connection after STARTTLS from[]
example postfix/smtpd[26413]: disconnect from[]

I think there is a problem with postfix configuration.

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thank you for your answer.

You have a broken TSL/SSL configuration.

Change/Add settings to:

myhostname =
myorigin = /etc/mailname
mydestination =,, localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

And create your own TSL/SSL Certificate :

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/mail.key -out /etc/ssl/certs/mailcert.pem

Finally change/add :

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_protocols = !SSLv2, !SSLv3

Don’t forget to restart postfix

PS: Check your DNS !!!

MX Record Priority 0

A Record IP_of_Droplet

PPS: I recommend Postfix+Dovecot+MySQL ( this guide is really good for newbies)

Thanks :) Here is postfix configuration file :

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =, localhost.localdomain, localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128 , < IP Address>
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
milter_protocol = 2
milter_default_action = accept
smtpd_milters = inet:localhost:12301
non_smtpd_milters = inet:localhost:12301

Welcome to DigitalOcean

Can you upload your configuration file ?