Help - Can't get postfix to send email with SSL

My provider wants me to start submitting email via SMTP with SSL encryption. I used to simply submit email via postfix to mr01.hansenet.de:465 like this:

main.cf:

relayhost = mr01.hansenet.de

sender_canonical:

foth       kilianfoth@alice-dsl.de

Both these are heavily obsolete, since those products/companies don’t exist anymore and everything is “O2” now, but so far it kept working, and I didn’t want to meddle with a working set-up.

Now the provider has started rejecting emails sent like this to other “alice.de” users (“Local senders are prohibited to send to local recipients without authentication”), and their support told me to switch to a new relay host; I’m afraid that old relay will be eventually switched off, so I should make the switch.

Unfortunately this means submitting SMTP email with SSL, and I’m failing at getting this to work. Having read advice from people on the internet who had the same problem, I tried these additional settings:

main.cf:

relayhost = smtp.o2mail.de:465
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = 
smtp_sasl_password_maps = hash:/etc/postfix/password
smtpd_sasl_auth_enable = no
smtp_use_tls = yes

sender_canonical:

foth       kilianfoth@o2mail.de

master.cf:

tlsmgr    unix  -       -       n       1000?   1       tlsmgr

password:

smtp.o2mail.de:465    kilianfoth@o2mail.de:MYPASSWORD

But I can’t get any mail through - /var/log/mail says

postfix/smtp[8960]: CLIENT wrappermode (port smtps/465) is unimplemented
postfix/smtp[8960]: instead, send to (port submission/587) with STARTTLS
postfix/smtp[8960]: connect to new.maila.net[204.45.2.141]:465: Connection timed out
postfix/smtp[8960]: 5361332C0732: to=<kilianfoth@meetingsphere.com>, relay=none, delay=30, delays=0.11/0.01/30/0, dsn=4.4.1, status=deferred (connect to new.maila.net[204.45.2.141]:465: Connection timed out)

Therefore I tried using STARTTLS by talking to port 587:

main.cf:

relayhost = smtp.o2mail.de:587

That takes care of the first problem, but I’m still timing out:

postfix/smtp[9016]: connect to new.maila.net[204.45.2.141]:587: Connection timed out
postfix/smtp[9016]: 14FAE32C0731: to=<kilianfoth@meetingsphere.com>, relay=none, delay=528, delays=498/0.01/30/0, dsn=4.4.1, status=deferred (connect to new.maila.net[204.45.2.141]:587: Connection timed out)

Now, I can reach smtp.o2mail.de fine via telnet, both on port 465 and 587, but not new.maila.net. Why would postfix talk to new.maila.net (204.45.2.141) instead of smtp.o2mail.de (91.136.8.189), and what can I do to prevent timing out?

On 2014-09-07 19:56, vhpd wrote:
>
> My provider wants me to start submitting email via SMTP with SSL
> encryption. I used to simply submit email via postfix to
> mr01.hansenet.de:465 like this:
>
> main.cf:
>
> Code:
> --------------------
> relayhost = mr01.hansenet.de
> --------------------

This means that ALL your email sent out by your postfix will be sent
over to “mr01.hansenet.de” for processing and sending.

> sender_canonical:
>
> Code:
> --------------------
> foth kilianfoth@alice-dsl.de
> --------------------

This means that mail sent by your local machine user “foth” will have
the from field changed to “kilianfoth@alice-dsl.de”.

>
>
> Both these are heavily obsolete, since those products/companies don’t
> exist anymore and everything is “O2” now, but so far it kept working,
> and I didn’t want to meddle with a working set-up.

I don’t know what is “O2”?

> Now the provider has started rejecting emails sent like this to other
> “alice.de” users (“Local senders are prohibited to send to local
> recipients without authentication”), and their support told me to switch
> to a new relay host; I’m afraid that old relay will be eventually
> switched off, so I should make the switch.

Mmm… rings and old bell.

I had an email like “me@somefriendofmine.org”. When using that host to
send to “someone@gmail.com” all when well. When sending to
foo@somefriendofmine.org”, it failed with a message like the one you
get. If I set the from to “me@gmail.com”, and sent to
foo@somefriendofmine.org”, it would work just fine - and I was not
using any relay, I was sending direct. That is, I was acting as MAIL
SERVER, not client.

This is BUG in the configuration of the “somefriendofmine.org” smtp
server, plain simple: mail sent to a destination hosted by that machine
can not request any authentication. It is against the rules.

It goes like this: if you send to a user local to that machine, you need
no authentication, that’s how email is supposed to work. If I work at
opensuse.org I can not have an authentication for redhat.org,
ubuntu.org, debian.org, etc. It is absurd, I can not have an
authentication for each destination. So, of course, it is not asked.

If I have an account at “somefriendofmine.org”, and I want to send an
email to “opensuse.org”, of course they are entitled to ask for
authentication, because I’m asking some one to relay my email to
somebody else.

So far, so good.

The problem is when “me@somefriendofmine.org” wants to send to
you@somefriendofmine.org”. The rule to apply is the first one, no
authentication. The server has a BUG because it applies rule two. It
does not detect that I’m not relaying.

It is impossible to fight this dumb-ass configuration. Use a different
server/provider.

Notice that the problem will likely be the same even if you change the
smarthost setting… because it triggers because you send as
kilianfoth@alice-dsl.de” to “someone@alice.de”. Changing the relayhost
will probably not help. And it is out of your control, because it is
mr01.hansenet.de” who does the talking, not you. Even if postfix has
some configuration to handle the above described dumb-ass situation, it
does nothing: you are not doing the mail sending, it is the relayhost
who does.

If mr01.hansenet.de are a different people than alice.de, talk to them;
they may be able to do something. If they are the same people… sigh :frowning:

> Unfortunately this means submitting SMTP email with SSL, and I’m failing
> at getting this to work. Having read advice from people on the internet
> who had the same problem, I tried these additional settings:

I can try help changing your relayhost, but I’m unsure it will help.

> main.cf:
>
> Code:
> --------------------
> relayhost = smtp.o2mail.de:465
> smtp_sasl_auth_enable = yes
> smtp_sasl_security_options =
> smtp_sasl_password_maps = hash:/etc/postfix/password
> smtpd_sasl_auth_enable = no
> smtp_use_tls = yes
> --------------------

I use :


smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Both smtp_use_tls and smtpd_use_tls are obsolete settings, might not
work. Instead, I have this:


smtp_tls_security_level = may
smtp_tls_loglevel = 1

sender_canonical:

Code:

foth       [email]kilianfoth@o2mail.de[/email]

That means that your sender address for user “foth” will be replaced by
kilianfoth@o2mail.de”.

master.cf:

Code:

tlsmgr    unix  -       -       n       1000?   1       tlsmgr

Ok.

password:

Code:

smtp.o2mail.de:465    [email]kilianfoth@o2mail.de[/email]:MYPASSWORD

Ok.

But I can’t get any mail through - /var/log/mail says

Code:

postfix/smtp[8960]: CLIENT wrappermode (port smtps/465) is unimplemented

postfix/smtp[8960]: instead, send to (port submission/587) with STARTTLS
postfix/smtp[8960]: connect to new.maila.net[204.45.2.141]:465: Connection timed out
postfix/smtp[8960]: 5361332C0732: to=kilianfoth@meetingsphere.com, relay=none, delay=30, delays=0.11/0.01/30/0, dsn=4.4.1, status=deferred (connect to new.maila.net[204.45.2.141]:465: Connection timed out)

Therefore I tried using STARTTLS by talking to port 587:

main.cf:

Code:

relayhost = smtp.o2mail.de:587

That takes care of the first problem, but I’m still timing out:

That particular problem is unfamiliar to me.

Code:

postfix/smtp[9016]: connect to new.maila.net[204.45.2.141]:587: Connection timed out

postfix/smtp[9016]: 14FAE32C0731: to=kilianfoth@meetingsphere.com, relay=none, delay=528, delays=498/0.01/30/0, dsn=4.4.1, status=deferred (connect to new.maila.net[204.45.2.141]:587: Connection timed out)

Now, I can reach smtp.o2mail.de fine via telnet, both on port 465 and
587, but not new.maila.net. Why would postfix talk to new.maila.net
(204.45.2.141) instead of smtp.o2mail.de (91.136.8.189), and what can I
do to prevent timing out?

Try:


relayhost = [smtp.o2mail.de]:587

That impedes postfix checking DNS for it. Look:


cer@Telcontar:~> host smtp.o2mail.de
smtp.o2mail.de has address 91.136.8.189
smtp.o2mail.de mail is handled by 10 new.maila.net.
cer@Telcontar:~>

And you may have to adapt the password entry.

I would try first


relayhost = [smtp.o2mail.de]:465

for curiosity sake… O:-)

HTH.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Wow. I bow to your superior postfix knowledge!

Adding the square brackets did the trick. I get connected to the server name I wrote, not to the presumed alias, and it talks to me:


postfix/pickup[5294]: BB40C32C0733: uid=1000 from=<foth>
postfix/cleanup[5315]: BB40C32C0733: message-id=<21517.58312.344697.93739@linux.site>
postfix/qmgr[5295]: BB40C32C0733: from=<kilianfoth@o2mail.de>, size=575, nrcpt=1 (queue active)
postfix/smtp[5317]: BB40C32C0733: to=<kilianfoth@meetingsphere.com>, relay=smtp.o2mail.de[91.136.8.189]:587, delay=2.5, delays=0.17/0.1/1.7/0.46, dsn=5.7.1, status=bounced (host smtp.o2mail.de[91.136.8.189] said: 550 5.7.1 <kilianfoth@meetingsphere.com>... Relaying denied: You must check for new mail before sending mail. (in reply to RCPT TO command))
postfix/cleanup[5315]: 41F7832C0734: message-id=<20140908171347.41F7832C0734@linux.site>
postfix/bounce[5319]: BB40C32C0733: sender non-delivery notification: 41F7832C0734
postfix/qmgr[5295]: 41F7832C0734: from=<>, size=2566, nrcpt=1 (queue active)
postfix/qmgr[5295]: BB40C32C0733: removed
postfix/smtp[5317]: 41F7832C0734: to=<kilianfoth@o2mail.de>, relay=smtp.o2mail.de[91.136.8.189]:587, delay=2.1, delays=0.03/0/1.7/0.34, dsn=2.0.0, status=sent (250 2.0.0 s88HFLEb008876 Message accepted for delivery)
postfix/qmgr[5295]: 41F7832C0734: removed


Of course the messages are still mixed - I get “250 Message accepted”, but also “You must check for new mail first” in the same session. I’ll have a look at my external email tomorrow and see whether I really got through, or whether I have to fiddle some more.

On 2014-09-08 19:26, vhpd wrote:

>> for curiosity sake… O:-)
>>
>
> Wow. I bow to your superior postfix knowledge!

Oops. No… I just happened to know that item, I’m not a postfix expert.
There was a real postfix expert on the opensuse mail list, but he/she
disappeared some years ago. And I miss him when I have problems.

> Adding the square brackets did the trick. I get connected to the server
> name I wrote, not to the presumed alias, and it talks to me:
>
>
> Code:
> --------------------
>
> postfix/pickup[5294]: BB40C32C0733: uid=1000 from=<foth>
> postfix/cleanup[5315]: BB40C32C0733: message-id=<21517.58312.344697.93739@linux.site>
> postfix/qmgr[5295]: BB40C32C0733: from=<kilianfoth@o2mail.de>, size=575, nrcpt=1 (queue active)
> postfix/smtp[5317]: BB40C32C0733: to=<kilianfoth@meetingsphere.com>, relay=smtp.o2mail.de[91.136.8.189]:587, delay=2.5, delays=0.17/0.1/1.7/0.46, dsn=5.7.1, status=bounced (host smtp.o2mail.de[91.136.8.189] said: 550 5.7.1 <kilianfoth@meetingsphere.com>… Relaying denied: You must check for new mail before sending mail. (in reply to RCPT TO command))
> postfix/cleanup[5315]: 41F7832C0734: message-id=<20140908171347.41F7832C0734@linux.site>
> postfix/bounce[5319]: BB40C32C0733: sender non-delivery notification: 41F7832C0734
> postfix/qmgr[5295]: 41F7832C0734: from=<>, size=2566, nrcpt=1 (queue active)
> postfix/qmgr[5295]: BB40C32C0733: removed
> postfix/smtp[5317]: 41F7832C0734: to=<kilianfoth@o2mail.de>, relay=smtp.o2mail.de[91.136.8.189]:587, delay=2.1, delays=0.03/0/1.7/0.34, dsn=2.0.0, status=sent (250 2.0.0 s88HFLEb008876 Message accepted for delivery)
> postfix/qmgr[5295]: 41F7832C0734: removed
>
>
> --------------------
>
>
> Of course the messages are still mixed - I get “250 Message accepted”,
> but also “You must check for new mail first” in the same session. I’ll
> have a look at my external email tomorrow and see whether I really got
> through, or whether I have to fiddle some more.

Wow. “You must check for new mail before sending mail”. That one. At
this point, if you intend to use postfix, I would suggest to seriously
consider another provider. It is not acting as a “smartrelayhost”.

That configuration is designed for use with clients such as outlook,
thunderbird, etc. The same program does the fetching and the sending,
and typically does the fetching periodically so that the server does not
forget who you are.

Instead, it should be asking you for login/password, on about every
email sent. And apparently it does not even ask.

If you want to use that server, I think that you need to configure
fetchmail as daemon to also pick your email from the same place,
and do it periodically, before the smtp auth times out.

Instead of smarthost, I use a different setup. I configure postfix to
choose which SMTP relay to choose based on the FROM address of every
email sent. And each FROM can have its own separate login/pass pair.

This allows me to send email like:

from me@gmailll.com to you@somewhere
from me@yahooo.com to you@somewhere
from me@opensuseeee.com to you@somewhere

And the first one is sent via google, the second one via yahoo, the
third via opensuse… etc. As many from addresses and users as needed.
Just three or thousands.

With a smarthost setup, which it works with only some providers and
specific contracts, you are supposed to send all those 3 via
smtp.o2mail.de, no questions asked, once you give your single
login/password. Even if you are acting mail server for a thousand users
at your university or business.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)