I have some web application which is used as a webmail client to exchange. I can pull emails from exchange server via IMAP, but problem is at sending mails.

Application is using MSMTP client to send mails, and I have installed local postfix mail server to relay all emails to exchange as described in the post:


and I also added Frontend recieve connector on exchange for practicular IP address of postfix server.

When I send a test email to postfix via msmtp i always recieve:

websrv1 postfix/smtp[36849]: 8618411EF7F: to=<mail@domain.com>, relay=mail.domain.com[]:587, delay=5, delays=0.01/0/0.02/5, dsn=5.7.1, status=bounced (host mail.domain.com[] said: 530 5.7.1 Client was not authenticated (in reply to MAIL FROM command))

So, what I need to do for this to work?

The msmtp client config:

account default
logfile /home/app/msmtp_default.log
host localhost
port 25
from mail@domain.com
keepbcc off
auth off

tls off
tls_certcheck off

Exchange server version is 2016.


I've done authentication, now I receive another error from exchange server:

5.7.1 Client does not have permissions to send as this sender (in reply to end of DATA command))

I am using authenticated relay, so my postfix server connects as particular user. What permissions I need to add to this user to be able to relay emails to exchange?

  • Where is.your user/pw information? Don't you use a SASL password file or similar? Sometimes the Exchange security logs show the real issue. – Lenniey Dec 24 '18 at 9:04

When using a relay server, like postfix, to communicate with exchange, you have to configure postfix with a user to authenticate with exchange for the email to be sent. You seem to have already done that step. However, in order for the authentication to be of any value, that user that you send as also has to have SendAs permissions for any email address that is being used to send mail from your web application. You can add this permission in powershell using the Add-RecipientPermission cmdlet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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