Hi, I’m working on an automated email support system and I am having a lot of trouble with the Rebex.net.smtp class. The SmtpClient in .Net works fine but there doesn’t seem to be a way to convert the Rebex MailMessage to the system.net.mail.mailmessage.
What seems to be happening is the smtp class gets a timeout exception after sending the message body. The messages I've tested with are simple text body and no attachments or resources. Its our corporate exchange server that does not require credentials, not using SSL.
Here's the code
Private Sub SendMMessageRebex(ByVal oMsg As MailMessage)
Dim _smtp As Smtp = Nothing
Try
_smtp = New Rebex.Net.Smtp()
With _smtp
.LogWriter = mTraceLogSMTPLogWriter
If mServiceConfig.SMTPPort = 0 Then
.Connect(mServiceConfig.SMTPHost, mServiceConfig.SMTPSSLMode)
Else
.Connect(mServiceConfig.SMTPHost, mServiceConfig.SMTPPort,
mServiceConfig.SMTPSSLMode)
End If
If mServiceConfig.SMTPRequireLogin Then
.Login(mServiceConfig.UserName, mServiceConfig.Password)
End If
.Send(oMsg)
.Disconnect()
End With
Catch ex As Exception
Fire_ReportStatus(Rebex.LogLevel.Error,
"err, could not Send forwarded message, {0}", ex.ToString())
Finally
If _smtp IsNot Nothing Then
_smtp.Dispose()
End If
_smtp = Nothing
End Try
End Sub
here is the Log (edited my info with x's)
Info: Connecting to xxx.xxx.xxx.xxx:25 using Smtp 2.0.4981.0.
Info: Connection succeeded.
Response: 220 xxx.xxx.xxx.xxx Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at Thu, 5 Sep 2013 16:28:00 -0400
Command: EHLO xxxxxxxx
Response: 250-xxx.xxx.xxx.xxx Hello [xxx.xxx.xxx.xxx]
Response: 250-TURN
Response: 250-SIZE
Response: 250-ETRN
Response: 250-PIPELINING
Response: 250-DSN
Response: 250-ENHANCEDSTATUSCODES
Response: 250-8bitmime
Response: 250-BINARYMIME
Response: 250-CHUNKING
Response: 250-VRFY
Response: 250-X-EXPS GSSAPI NTLM LOGIN
Response: 250-X-EXPS=LOGIN
Response: 250-AUTH GSSAPI NTLM LOGIN
Response: 250-AUTH=LOGIN
Response: 250-X-LINK2STATE
Response: 250-XEXCH50
Response: 250 OK
Command: MAIL FROM:<xxxxxx> BODY=8BITMIME SIZE=287
Response: 250 2.1.0 xxxxxx....Sender OK
Command: RCPT TO:<xxxxxx> NOTIFY=FAILURE
Response: 250 2.1.5 xxxxxx
Command: BDAT 287 LAST
Info: Rebex.Net.SmtpException: Timeout exceeded.
at Rebex.Net.Smtp.AL()
at Rebex.Net.Smtp.NL(Int32 A, Boolean B)
at Rebex.Net.Smtp.YBB(Boolean A, String[] B, VHB C, String D, Int64 E)
at Rebex.Net.Smtp.ACB(String A, String[] B, String C, Stream D, TransferEncoding E)
at Rebex.Net.Smtp.GCB(MimeMessage A, Stream B, MailAddress C, MailAddressCollection D)
at Rebex.Net.Smtp.HCB(MimeMessage A, MailAddress B, MailAddressCollection C)
Command: QUIT