Archived Forum Post

Index of archived forum posts

Question:

Must issue a STARTTLS is ignored

Aug 15 '15 at 18:35

When attempting to OpenSmtpConnection in Chilkat Version 9.5.0.48 The settings are not configured correctly. A common mistake for users. We have implemented a Test button to verify the settings are correct. Unfortunately if SSL and TLS options have not been set this log is what happens.

Is there a setting to prevent this error from being ignored?

  <ensureSmtpAuthenticated>
    <smtpAuthenticate>
      <smtp_host>smtp.gmail.com</smtp_host>
      <smtp_port>25</smtp_port>
      <smtp_user>mySmtpLogin</smtp_user>
      <smtpAuthenticate>
        <info>This SMTP server did not list authentication methods.</info>
        <info>Defaulting to LOGIN authentication method.</info>
        <login_method>LOGIN</login_method>
        <auth_login>
          <smtpSendGet2>
            <sendCmdToSmtp>
              <SmtpCmdSent><![CDATA[AUTH LOGIN<CRLF>]]></SmtpCmdSent>
            </sendCmdToSmtp>
            <readSmtpResponse>
              <SmtpCmdResp>530 5.7.0 Must issue a STARTTLS command first. y145sm7205134ywd.0 - gsmtp</SmtpCmdResp>
            </readSmtpResponse>
          </smtpSendGet2>
          <error>AUTH LOGIN failed</error>
        </auth_login>
        <info>Ignoring the error, assuming no authentication is necessary.</info>
      </smtpAuthenticate>
      <ConnectionType>Unencrypted TCP/IP</ConnectionType>
    </smtpAuthenticate>
  </ensureSmtpAuthenticated>

Accepted Answer

In 9.5.0.51, the VerifySmtpLogin method returns a success. I know it should fail for one of two reasons.

  1. StartTLS is required by the server.
  2. The username and password are invalid.

I decided to look at the OpenSmtpConnection and SmtpAuthenticate methods to see what type of detail I was getting from the LastErrorXml. The results are very different from VerifySmtpLogin.

I have received a preview of 9.5.0.52, and the VerifySmtpLogin is returning a failure code.


Answer

Instead of rolling your own test methods, do the VerifySmtpConnection and VerifySmtpLogin methods accomplish what you need?