Linode Postfix configuration

Hi All,

I have followed exactly the following to setup postfix on ubuntu with gmail apps.

https://www.linode.com/docs/email/postf … oogle-apps">https://www.linode.com/docs/email/postfix/postfix-smtp-debian7#settings-for-google-apps

postfix/main.cf:

smtpdbanner = $myhostname ESMTP $mailname (Ubuntu)

biff = no

appending .domain is the MUA's job.

appenddotmydomain = no

Uncomment the next line to generate "delayed mail" warnings

delaywarningtime = 4h

readme_directory = no

TLS parameters

smtpdtlscert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem

smtpdtlskey_file=/etc/ssl/private/ssl-cert-snakeoil.key

smtpdtlssessioncachedatabase = btree:${datadirectory}/smtpdscache

smtptlssessioncachedatabase = btree:${datadirectory}/smtpscache

enable SASL authentication

smtpsaslauth_enable = yes

disallow methods that allow anonymous authentication.

smtpsaslsecurity_options = noanonymous

where to find sasl_passwd

smtpsaslpasswordmaps = hash:/etc/postfix/saslpasswd

Enable STARTTLS encryption

smtpusetls = yes

where to find CA certificates

smtptlsCAfile = /etc/ssl/certs/ca-certificates.crt

See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for

information on enabling SSL in the smtp client.

smtpdrelayrestrictions = permitmynetworks permitsaslauthenticated deferunauth_destination

myhostname = allhealthy.co.uk

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

myorigin = /etc/mailname

mydestination = allhealthy.co.uk, localhost.co.uk, , localhost

relayhost = [smtp.gmail.com]:587

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

mailboxsizelimit = 0

recipient_delimiter = +

inet_interfaces = all

inet_protocols = all

etc/hosts:

127.0.0.1 allhealthy.co.uk localhost allhealthy

Following is not sending any mail. No error message in /var/log/mail.log /var/log/mail.err

sendmail xyz@gmail.com

FROM: admin@allhealthy.co.uk

SUBJECT: test

test

.

What is wrong?

Thx

CK

5 Replies

Your /etc/hosts is definitely wrong. It should be like this:

127.0.0.1 localhost
123.456.789.123 allhealthy.co.uk allhealthy

where the obviously faked IP 123.456.789.123 should be your own IP.

Exactly done as you said. It is also weird that there is nothing on /var/log/mail.log. It is blank. No error messages. I keep sending messages with sendmail from command prompt and nothing happens.

The DNS settings on Linode:

MX Records

Mail Server Preference Subdomain TTL Options

ALT2.ASPMX.L.GOOGLE.COM 5 300 (5 minutes) Edit | Remove

ALT1.ASPMX.L.GOOGLE.COM 5 300 (5 minutes) Edit | Remove

ALT3.ASPMX.L.GOOGLE.COM 10 Default Edit | Remove

I do not know what to do. At least I should get an error or some trace log of what is going on..

I even added the following to main.cf for debug messages.

debugpeerlevel = 2

debugpeerlist = mydomainhere

Thx for the help.

Today, I started to get some output on the mail.log

When I sent the mail, I get the following but still the mail is not reached at the destination:

Jun 12 10:21:25 allhealthy postfix/pickup[7651]: 0A21D340A1: uid=1000 from= Jun 12 10:21:25 allhealthy postfix/cleanup[9609]: 0A21D340A1: message-id=<20150612062125.0A21D340A1@allhealthy.co.uk>

Jun 12 10:21:25 allhealthy postfix/qmgr[3180]: 0A21D340A1: from=<forge@allhealthy.co.uk>, size=273, nrcpt=1 (queue active)

Jun 12 10:21:25 allhealthy postfix/local[9611]: 0A21D340A1: to=<sales@allhealthy.co.uk>, relay=local, delay=23, delays=23/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)

Jun 12 10:21:25 allhealthy postfix/qmgr[3180]: 0A21D340A1: removed

I have even checked the spam of the "To" destination. No mail! By the way I am using Google Apps…

Thx a lot.

Yes now it worked finally.

main.cf

smtpdrelayrestrictions = permitmynetworks permitsaslauthenticated deferunauth_destination

myhostname = allhealthy.co.uk

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

myorigin = /etc/mailname

mydestination = localhost

relayhost = [smtp.gmail.com]:587

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

mailboxsizelimit = 0

recipient_delimiter = +

inet_interfaces = all

inet_protocols = all

etc/hosts

127.0.0.1 localhost

109.237.24.35 allhealthy.co.uk allhealthy localhost mail.allhealthy.co.uk

Based on previous discussions in the forum, my understanding is that if you send mail from a Gmail account that gets redirected back to that account, it will not appear in your inbox (but will be in your sent messages). So if mail to your sales@ address ends up being forwarded to the account you're sending mail from, Gmail will take it upon itself to ignore the message, since it knows you sent it.

It's not exactly clear whether this applies to your situation here, but thought it might be a potential point of confusion.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct