Question:
Hi, I'm trying to send multiple notifications and want to verify the smtp login before starting any preparation for sending the notifications, but my problem is the calls to VerifySmtpLogin don't seem to do anything before my first SentEmail call.
var mailman = new MailMan();
mailman.SmtpHost = _settings.EmailServer;
mailman.SmtpSsl = _settings.UseSsl;
mailman.StartTLS = _settings.UseTls;
mailman.SmtpPort = _settings.SmtpPort;
mailman.SmtpUsername = _settings.SmtpUsername;
mailman.SmtpPassword = _settings.SmtpPassword;
mailman.ReadTimeout = 15;
mailman.ConnectTimeout = 15;
var smtpLoginIsValid = mailman.VerifySmtpLogin(); // false
var verifySmtpConnection = mailman.VerifySmtpConnection(); // false
if (!mailman.SendEmail(email))
{
throw new Exception(string.Format("Unable to send mail. {0}", mailman.LastErrorText));
}
// credentials didn't change at all
var smtpLoginIsValid = mailman.VerifySmtpLogin(); // true
var verifySmtpConnection = mailman.VerifySmtpConnection(); // true
Do I need to initialize something before calling verifyxxx?
Check out this Chilkat article on the Invalid Token error, it might help:
http://www.chilkatsoft.com/refdoc/xChilkatMailMan2Ref.html
Essentially it says that you are trying to use SSL on a non-SSL port. Does it work if you use Port 465 instead (with UseSsl = 1), or port 587 with UseSsl = 0?
The project ist about 3 years old, inclused is the Version: ChilkatDotNet2.dll Version 9.0.4.0. The Target .NET Framework is 3.5.
I dindnt see a VerboseLogging, maybe my chillkat version is to old? The Value from LastErrorText is:
"ChilkatLog: VerifySmtpLogin: DllDate: Sep 8 2009 UnlockPrefix: UGlauxMAIL Username: haegeli Component: .NET 2.0 / x64 Need new SMTP connection SMTP_Connect: Connecting to SMTP server smtp.office365.com:587 smtp_host: smtp.office365.com smtp_port: 587 smtp_user: apptest@glauxsoft.com protocol: default Invalid token. ReceivedDataQP: 220 DB4PR04CA0002.outlook.office365.com Microsoft ESMTP MAIL Service rea= dy at Tue, 25 Nov 2014 16:40:03 +0000SEC_E_INVALID_TOKEN Aborting SSL client handshake because of fatal error Error performing handshake Failed to connect to SMTP server. Failed to connect to SMTP server. Failed. "
I repeated the same thing with v9.5.0.45 for the .NET 3.5 frameworks with the same result.
I tried with 9.5.0.45 using known good credentials and settings and it worked as expected (VerifySmtpLogin returned 1 on the first call).
A few things: