Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've got a PHP web app set up which, when a user submits the form, sends an acknowledgement email from, 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
    tls on
    tls_starttls on
    tls_trust_file /etc/ssl/certs/ca-certificates.crt

    port 25
    #auth on
    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 tls=on auth=on user=username 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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

the server does not support TLS via the STARTTLS command

There's your it would seem that your Exchange server isn't setup properly for TLS.

  1. Telnet to the Exchange server on port 25

  2. Enter ehlo, If “250-STARTTLS” is listed in the response, Opportunistic TLS is offered.

If not, you'll need to enable TLS on the receive connector:

Set-ReceiveConnector “ReceiveConnectorName” –DomainSecureEnabled $true –AuthMechanism TLS

However, understand what you are doing first, as the Receive connector might be used for other inbound traffic and it won't FORCE TLS so read the following Technet article FIRST!

See here for more information on setting up mutual TLS on Exchange:

Otherwise you can disable TLS in MSMTP if you'd like.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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