2

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:

http://www.techspacekh.com/configuring-postfix-to-relay-mail-to-local-exchange-mail-server-in-rhel-centos-7/

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[192.168.10.2]:587, delay=5, delays=0.01/0/0.02/5, dsn=5.7.1, status=bounced (host mail.domain.com[192.168.10.2] 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.

UPDATE

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?

Marko Farkas
  • 163
  • 3
  • 11
  • 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 09:04

1 Answers1

1

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.

2ps
  • 1,076
  • 8
  • 11