Archived Forum Post

Index of archived forum posts

Question:

Socket timeout on sending SMTP

Apr 17 '15 at 03:25

Dear all,

I am trying to send out an SMTP email using the "mailman" but I keep getting a socket timeout in the process:

      SendEmail:
    DllDate: Mar  6 2015
    ChilkatVersion: 9.5.0.48
    UnlockPrefix: GUDFINMAILQ
    Username: GKRPROD01:SYSTEM
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    sendEmailInner:
      renderToMime:
        createEmailForSending:
          xSigningAlg: sha1
          Auto-generating Message-ID
        --createEmailForSending
        renderToMime: Elapsed time: 0 millisec
      --renderToMime
      sendMimeInner:
        progressTotal: 5355
        ensureSmtpSession:
          ensureSmtpConnection:
            SmtpHost: mail.axelero.hu
            SmtpPort: 25
            SmtpUsername: gkristj
            SmtpSsl: 0
            StartTLS: 0
            smtpConnect:
              smtpHostname: mail.axelero.hu
              smtpPort: 25
              connectionIsReady:
                Need new SMTP connection
              --connectionIsReady
              smtpSocketConnect:
                socketOptions:
                  SO_SNDBUF: 262144
                  SO_RCVBUF: 4194304
                  TCP_NODELAY: 1
                --socketOptions
              --smtpSocketConnect
              smtpGreeting:
                readSmtpResponse:
                  SmtpCmdResp: 220 mail01d.mail.t-online.hu ESMTP You must authenticate before sending mail
                --readSmtpResponse
              --smtpGreeting
              ehloCommand:
                sendCmdToSmtp:
                  SmtpCmdSent: EHLO GKRPROD01<crlf>
                --sendCmdToSmtp
                readSmtpResponse:
                  SmtpCmdResp: 250-mail01d.mail.t-online.hu
                  SmtpCmdResp: 250-PIPELINING
                  SmtpCmdResp: 250-SIZE 26214400
                  SmtpCmdResp: 250-VRFY
                  SmtpCmdResp: 250-ETRN
                  SmtpCmdResp: 250-STARTTLS
                  SmtpCmdResp: 250-AUTH PLAIN LOGIN
                  SmtpCmdResp: 250-AUTH=PLAIN LOGIN
                  SmtpCmdResp: 250-ENHANCEDSTATUSCODES
                  SmtpCmdResp: 250-8BITMIME
                  SmtpCmdResp: 250 DSN
                --readSmtpResponse
              --ehloCommand
            --smtpConnect
          --ensureSmtpConnection
          ensureSmtpAuthenticated:
            smtpAuthenticate:
              smtp_host: mail.axelero.hu
              smtp_port: 25
              smtp_user: gkristj
              smtpAuthenticate:
                login_method: LOGIN
                auth_login:
                  smtpSendGet2:
                    sendCmdToSmtp:
                      SmtpCmdSent: AUTH LOGIN<crlf>
                    --sendCmdToSmtp
                    readSmtpResponse:
                      SmtpCmdResp: 334 VXNlcm5hbWU6
                    --readSmtpResponse
                  --smtpSendGet2
                  sendCmdToSmtp:
                    SmtpCmdSent: Z2tyaXN0ag==<crlf>
                  --sendCmdToSmtp
                  readSmtpResponse:
                    SmtpCmdResp: 334 UGFzc3dvcmQ6
                  --readSmtpResponse
                  sendCmdToSmtp:
                    SmtpCmdSent: {PasswordOrCredentials}
                  --sendCmdToSmtp
                  readSmtpResponse:
                    SmtpCmdResp: 235 2.7.0 Authentication successful
                  --readSmtpResponse
                --auth_login
              --smtpAuthenticate
              ConnectionType: Unencrypted TCP/IP
            --smtpAuthenticate
          --ensureSmtpAuthenticated
        --ensureSmtpSession
        sendSmtpEmail:
          sendWithPipelining:
            sendMailFrom:
              mailFrom: admin@thehuntinglounge.com
              sendCmdToSmtp:
                SmtpCmdSent: MAIL FROM:<admin@thehuntinglounge.com><crlf>
              --sendCmdToSmtp
            --sendMailFrom
            sendRcptTo:
              sendCmdToSmtp:
                SmtpCmdSent: RCPT TO:<gudfinnur@gkr2004.com><crlf>
              --sendCmdToSmtp
            --sendRcptTo
            sendCmdToSmtp:
              SmtpCmdSent: DATA<crlf>
            --sendCmdToSmtp
            readSmtpResponse:
              SmtpCmdResp: 354 Ready, steady, go
            --readSmtpResponse
            readRcptTo:
              readSmtpResponse:
                SmtpCmdResp: 250 2.1.0 Ok
              --readSmtpResponse
              recipient: gudfinnur@gkr2004.com
            --readRcptTo
            readSmtpResponse:
              SmtpCmdResp: 250 2.1.5 Ok
            --readSmtpResponse
            smtpRset:
              Sending RSET command.
              smtpSendGet2:
                sendCmdToSmtp:
                  SmtpCmdSent: RSET<crlf>
                --sendCmdToSmtp
                readSmtpResponse:
                  recvUntilMatch: Socket operation timeout.
                --readSmtpResponse
              --smtpSendGet2
            --smtpRset
          --sendWithPipelining
        --sendSmtpEmail
      --sendMimeInner
    --sendEmailInner
    Failed.
  --SendEmail
--ChilkatLog
Everything seems ok, until it is time to send out the actual body of the email. Any ideas?

Thanks,

Gudfinnur Kristjansson


Answer

Your SMTP server seems to be responding to each pipelined command in reverse order. For example, if I send email via smtp.gmail.com, it works as it should:

          sendWithPipelining:
            sendMailFrom:
              mailFrom: chilkat.support@gmail.com
              sendCmdToSmtp:
                SmtpCmdSent: MAIL FROM:<chilkat.support@gmail.com><crlf>
              --sendCmdToSmtp
            --sendMailFrom
            sendRcptTo:
              sendCmdToSmtp:
                SmtpCmdSent: RCPT TO:<admin@chilkatsoft.com><crlf>
              --sendCmdToSmtp
            --sendRcptTo
            sendCmdToSmtp:
              SmtpCmdSent: DATA<crlf>
            --sendCmdToSmtp
            readSmtpResponse:
              SmtpCmdResp: 250 2.1.0 OK i80sm5219011iod.6 - gsmtp
            --readSmtpResponse
            readRcptTo:
              readSmtpResponse:
                SmtpCmdResp: 250 2.1.5 OK i80sm5219011iod.6 - gsmtp
              --readSmtpResponse
              recipient: admin@chilkatsoft.com
            --readRcptTo
            readSmtpResponse:
              SmtpCmdResp: 354  Go ahead i80sm5219011iod.6 - gsmtp
            --readSmtpResponse
          --sendWithPipelining
          mimeDataSize: 347
          sendDataToSmtp:
            numBytesSent: 347
          --sendDataToSmtp
          sendCmdToSmtp:
            SmtpCmdSent: <crlf>.<crlf>
          --sendCmdToSmtp
          readSmtpResponse:
            SmtpCmdResp: 250 2.0.0 OK 1429223498 i80sm5219011iod.6 - gsmtp
          --readSmtpResponse
        --sendSmtpEmail

In both your case and mine, the order of commands is:

MAIL FROM
RCPT TO
DATA

The responses SHOULD be in this order:

250
250
354

(The 354 is the success response code for the DATA command)

Your SMTP server sends responses in reverse order:

354
250
250

Your SMTP server indicates it's doing pipelining, but it seems to be behaving incorrectly. I'll be adding a new property to explicitly turn off the pipelining feature in v9.5.0.49


Answer

Thanks for the quick response.

Yes, it all works fine in my development environment (HMailserver) but when I deploy to production (third party SMTP server), this problem comes up.

I'll be waiting for v9.5.0.49.

Gudfinnur Kristjansson