Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is what I did..

sudo apt-get install postfix

This is my /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

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=no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname = tsXXX561.server.topcloud.it

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

myorigin = /etc/mailname
mydestination =
relayhost = [smtp.gmail.com]:587
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 = smtp
relay_transport = smtp
inet_protocols = all

# SASL Settings
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem

Then I created the file /etc/mailname with my hostname as content:

tsXXX561.server.topcloud.it

Then I created the file /etc/postfix/sasl_passwd:

[smtp.gmail.com]:587 gmail_username@gmail.com:gmail_password

Then sudo postmap /etc/postfix/sasl/passwd

sudo cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

service postfix restart

Still sends nothing... I'm on Ubuntu Server 12.04.

share|improve this question
2  
What is it you're actually trying to do? It's really not clear. –  growse Jun 2 '12 at 20:28

3 Answers 3

up vote 1 down vote accepted

Consult your /var/log/mail.log for details.

Your config seems to be correct and actually works as for satellite site config for postfix on Ubuntu 12.04.

share|improve this answer

It's not really a one-liner to configure postfix for gmail, so I made a configuration script that does the whole process automatically. The script will ask you for your gmail username and password, and configure everything else automatically.

Check it out here.

I suggest you to purge (delete) all existing postfix configuration before running the script. You can do this by running:

sudo apt-get purge -y postfix

share|improve this answer

Maybe you're using the wrong certificate? I don't actually know anything about Postfix configuration, but according to this 2009 tutorial, you should be using this instead of the Thawte cert:

sudo cat /etc/ssl/certs/Equifax_Secure_CA.pem >> /etc/ssl/certs/cacert.pem

(The latter folder structure may need to be tweaked, as it looks different from yours.)

There's also another tutorial here that may help. Good luck.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.