I've got a PHP web app set up which, when a user submits the form, sends an acknowledgement email from username@domainname.co.uk
, and also sends details of their enquiry from the same email address to a predefined mailbox. It's running on a Debian Wheezy server.
In development I was using a Gmail account with MSMTP, which was easy to set up and worked fine. However, we're going live soon and I want to configure it to send via the existing mail server for that domain. However, the mail server uses MS Exchange, and a Google search hasn't shown up much on using Exchange with MSMTP.
Ideally I'd like to just amend the MSMTP config so that it can send emails via the existing Exchange, much like I was already doing, but I can't seem to get it configured correctly. Here's my /etc/msmtprc:
# ------------------------------------------------------------------------------
# msmtp System Wide Configuration file
# ------------------------------------------------------------------------------
# A system wide configuration is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
# ------------------------------------------------------------------------------
# Accounts
# ------------------------------------------------------------------------------
# Main Account
defaults
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account username@domainname.co.uk
host domainname.co.uk
port 25
#auth on
from username@domainame.co.uk
user username
password password
logfile /var/log/msmtp.log
# ------------------------------------------------------------------------------
# Configurations
# ------------------------------------------------------------------------------
# Construct envelope-from addresses of the form "user@oursite.example".
#auto_from on
#maildomain fermmy.server
# Use TLS.
#tls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.
# Must be done within "account" sub-section above
#syslog LOG_MAIL
# Set a default account
# ------------------------------------------------------------------------------
Here is the error message I get in /var/log/msmtp.log
:
Sep 23 11:34:44 host=username.co.uk tls=on auth=on user=username from=username@domainname.co.uk recipients=myusername@mydomain.com errormsg='the server does not support TLS via the STARTTLS command' exitcode=EX_UNAVAILABLE
Can anyone point out where I have gone awry with this? I suppose it's possible I might be better off installing Postfix, setting that up as a null client, and adding the server to the MX records, but I would prefer to do it this way so the sent emails are retained by the Exchange server.