Archived Forum Post

Index of archived forum posts

Question:

send email failed

Aug 16 '16 at 15:18

Anyone can help? Thanks. send email function is in a for loop.

send 1st email: success, sleep 1 minutes. send 2nd email: failed, sleep 1 minutes. send 3rd email: success, sleep 1 minutes. ...

Error HTML:

Chilkat:ChilkatLog:

AddBcc:

DllDate: Jun 13 2016
ChilkatVersion: 9.5.0.58
UnlockPrefix: blahblah
Architecture: Little Endian; 64-bit
Language: .NET 4.5 / x64
VerboseLogging: 0
name: 
address: blahblah@blahblah.com

--AddBcc

--ChilkatLog


Answer

You are showing the LastErrorText for the Email object (for the call to the AddBcc method).

What you need is to show the MailMan object's LastErrorText for the SendEmail method call.


Answer

Chilkat:MailManSmtp Login Status : ChilkatLog:

SendEmail:

DllDate: Jun 13 2016
ChilkatVersion: 9.5.0.58
UnlockPrefix: xxxxxxx
Architecture: Little Endian; 64-bit
Language: .NET 4.5 / x64
VerboseLogging: 0
Component successfully unlocked using purchased unlock code.
sendEmailInner:
  renderToMime:
    createEmailForSending:
      xSigningAlg: sha1
      Auto-generating Message-ID
    --createEmailForSending
    renderToMime: Elapsed time: 0 millisec
  --renderToMime
  sendMimeInner:
    progressTotal: 17220
    ensureSmtpSession:
      ensureSmtpConnection:
        SmtpHost: smtp.emailsrvr.com
        SmtpPort: 25
        SmtpUsername: xxxx@xxxx.net
        SmtpSsl: 0
        StartTLS: 0
        smtpConnect:
          smtpHostname: smtp.emailsrvr.com
          smtpPort: 25
          connectionIsReady:
            Using existing/open SMTP connection to send email.
          --connectionIsReady
          ConnectionType: Unencrypted TCP/IP
        --smtpConnect
      --ensureSmtpConnection
    --ensureSmtpSession
    sendSmtpEmail:
      sendNonPipelining:
        sendMailFrom:
          mailFrom: demo@xxx.xxx
          sendCmdToSmtp:
            SmtpCmdSent: MAIL FROM:<demo@xxx.xxx><CRLF>
          --sendCmdToSmtp
        --sendMailFrom
        readSmtpResponse:
          SmtpCmdResp: 421 4.4.2 smtp29.relay.dfw1a.emailsrvr.com Error: timeout exceeded
        --readSmtpResponse
        smtpRset:
          Sending RSET command.
          smtpSendGet2:
            sendCmdToSmtp:
              SmtpCmdSent: RSET<CRLF>
            --sendCmdToSmtp
          --smtpSendGet2
        --smtpRset
      --sendNonPipelining
    --sendSmtpEmail
  --sendMimeInner
--sendEmailInner
Failed.

--SendEmail --ChilkatLog


Answer

When SendEmail is called, the connection to the SMTP server is kept open so that a subsequent call to SendEmail can continue using the same connection (rather than re-connecting, re-authenticating, etc.)

When your app slept for 1 minute, there was a period of inactivity. When you tried to call SendEmail again, the server responded with:

SmtpCmdResp: 421 4.4.2 smtp29.relay.dfw1a.emailsrvr.com Error: timeout exceeded
Apparently, the "timeout exceeded" was the fact that the connection was idle for so long. The solution is to simply disconnect prior to sleeping. Call mailman.CloseSmtpConnection before sleeping. The next call to SendEmail will automaticaly re-establish the connection and all will be fine..