We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

SMTP / POP3 / IMAP - test conenction with wrong Login / Password- yet return no error

Hi,


We recently upgraded to Aspose.Email 5.7, and implement codes to test all 3 emails protocol, but fail to return correct result.
With wrong Login (email address) / Password or both, pop3Client / imapClient / smtpClient always return connected without error.
Have try to on off the property - UseDefaultCredentials, UseAuthentication, SecurityOptions.Auto (for SSL). All test connection return pass without error.

Here is the sample code.

– smtp –
mSmtpClient = new SmtpClient(Server, Port, Login, Password);
mSmtpClient.AuthenticationMethod = SmtpAuthentication.Login;
mSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mSmtpClient.UseDefaultCredentials = true;
mSmtpClient.UseAuthentication = true;
if (EnableSSL)
{
mSmtpClient.SecurityOptions = SecurityOptions.SSLImplicit;
//mSmtpClient.SecurityOptions = SecurityOptions.Auto;
}

– pop3 –
mPop3Client = new Pop3Client(Server, Port, Login, Password);
mPop3Client.UseDefaultCredentials = true;
mPop3Client.UseAuthentication = true;
if (EnableSSL)
{
mPop3Client.SecurityOptions = SecurityOptions.SSLImplicit;
//mPop3Client.SecurityOptions = SecurityOptions.Auto;
}



Hi,


SmtpCleint and Pop3Client do not connect to the server when these are initialized. However when we perform some operation like sending mail through SmtpClient, then it actually connects to the server. Before any operation, its state is Closed. If we provide wrong credentials or set wrong properties while initializing the SmtpClient or Pop3Client, it does not matter as it has not connected to server yet. Could you please explain how it returns the connected state without error with wrong credentials? How do you test the connection as Pass with wrong credentials and properties? It will help us to understand the problem and provide assistance accordingly.
With correct or wrong credentials, always the connection state = closed.

In earlier version of Aspose Email, it comes with "Connect" and "Login" properties, to test the valid credential, before fetching email.

To test the valid credential while configuring smtp and pop3 settings, before start mass production of download and upload emails, is very important step for our software.

System will ensure user enter the correct credentials at setting, test the credentials, before start the production routine, especially depends on job scheduler to trigger the job.

So, we need this features to test correct credential.

Hi,


These methods were once part of the API but were removed due to the extra overhead involved while checking for connectivity and login. We are sorry but these can’t be re-included in the API anymore. You can, however, test the connectivity using any other other short command in any of the protocol such as getting mailbox size or message count and checking in a try-catch block for any exception raised. This will help you identify if the credentials are correct or not. Please share your feedback with us in case you have further concerns about this problem.

Hi,


Yes, I am working on the similar approach, getting mailbox info, to confirm the valid credential.

Anyway, thanks for the prompt reply.

Hi,


Thank you for your feedback. Please feel free to write to us if you have any other query about the API.