Archived Forum Post

Index of archived forum posts


MailMan.VerifySmtpLogin only works after SendEmail

Nov 26 '14 at 06:54

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?

Accepted Answer

Check out this Chilkat article on the Invalid Token error, it might help:

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 The Target .NET Framework is 3.5.

I repeated the same thing with v9.5.0.45 for the .NET 3.5 frameworks with the same result.


I tried with using known good credentials and settings and it worked as expected (VerifySmtpLogin returned 1 on the first call).

A few things: