Archived Forum Post

Index of archived forum posts

Question:

SMTP "504 5.7.4 Unrecognized authentication type" Error with smtp.office365.com

Mar 20 '14 at 14:09

I get the following error w/ smtp.office365.com when trying to send email:

    SmtpConnect:
      SmtpHost: smtp.office365.com
      SmtpPort: 587
      SmtpUsername: abc
      SmtpSsl: 0
      StartTLS: 0
      SmtpAuthMethod: LOGIN
      Need new SMTP connection
      checkForExistingConnection: Elapsed time: 0 millisec
      SMTP_Connect:
        Connecting to SMTP server smtp.office365.com:587
        smtp_host: smtp.office365.com
        smtp_port: 587
        smtp_user: abc
        auth-method: LOGIN
        ConnectTimeoutMs_1: 300000000
        calling ConnectSocket2
        IPV6 enabled connect with NO heartbeat.
        connectingTo: smtp.office365.com
        resolveHostname1:
          Resolving domain name (IPV4) via gethostbyname
        --resolveHostname1
        GetHostByNameHB_ipv4: Elapsed time: 16 millisec
        connect successful (1)
        Turning on TCP_NODELAY.
        socketOptions:
          SO_SNDBUF: 8192
          SO_RCVBUF: 8192
          TCP_NODELAY: 1
        --socketOptions
        socketConnect: Elapsed time: 78 millisec
        SmtpCmdResp: 220 DM2PR02CA006.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 11 Mar 2014 19:54:07 +0000
        initialResponse: Elapsed time: 63 millisec
        ehloCommand: EHLO xyz
        SmtpCmdSent: EHLO xyz<crlf>
        sendEhlo: Elapsed time: 0 millisec
        SmtpCmdResp: 250-DM2PR02CA006.outlook.office365.com Hello [11.12.33.24]
        SmtpCmdResp: 250-SIZE 78643200
        SmtpCmdResp: 250-PIPELINING
        SmtpCmdResp: 250-DSN
        SmtpCmdResp: 250-ENHANCEDSTATUSCODES
        SmtpCmdResp: 250-STARTTLS
        SmtpCmdResp: 250-8BITMIME
        SmtpCmdResp: 250-BINARYMIME
        SmtpCmdResp: 250 CHUNKING
        ehloResponse: 250-DM2PR02CA006.outlook.office365.com Hello [11.12.33.24]
250-SIZE 78643200
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250 CHUNKING
        smtpAuthMethod: LOGIN
        login_method: LOGIN
        auth_login_1:
          SmtpCmdSent: AUTH LOGIN<crlf>
          SmtpCmdResp: 504 5.7.4 Unrecognized authentication type
          504 5.7.4 Unrecognized authentication type
          Failed to send AUTH LOGIN
        --auth_login_1
        Failed to login using LOGIN method
      --SMTP_Connect
      checkOrMakeSmtpConnection: Elapsed time: 5382 millisec
    --SmtpConnect
    Failed.
  --SendEmail
--ChilkatLog


Answer

The cause of the problem is that smtp.office365.com is not allowing the LOGIN authentication method over a non-secure connection. The LastErrorText reveals that no SSL/TLS is being used with this connection:

      SmtpSsl: 0
      StartTLS: 0
We can also see that port 587 is being used, and this port is a typical alternative SMTP port that is customarily used w/ STARTTLS (which is explicit SSL/TLS).

The solution is to set the mailman.StartTLS property = true.