I use Aspose.Email to send mail using SMTP to communicate with our exchange 2016 server.
With Aspose.Email 19.12 everything worked fine, but when I upgraded to 20.12 it stopped working.
I also tried 21.1, same problem.
Edit 13:10: I know the exact versionnr of the version where it doesn’t work anymore. It’s 20.12. In 20.11 it’s working, in 20.12 not.
If I send an email, an error “Operation has been canceled” occurs. (OperationCanceledException)
Some details:
- SMTP server is only accessible on premise
- Connect to port 25
- Login with username/password
- SecurityOptions set to ‘Auto’.
Note: If I set SecurityOptions to ‘None’ I’ll get a different error: Authentication Failed.
Trace:
System.OperationCanceledException: Operation has been canceled
at #=zzukH64qg$tm92KBZitvQtVDGlotw.#=zpiK2ofQ=(IAsyncResult #=z4fp5qus=)
at #=zzukH64qg$tm92KBZitvQtVDGlotw.#=zgq$rb8U=()
at #=zVtEuSOHpzqzupz$AbByJd9OtqIL2Vb8UGljlmf4=.#=zJF_TWIE=(#=zyQ7xRVUnf1XuFJjGp6kU54zdiZNmN3Qp0w== #=zxE_VckI=)
at #=zEITzYyCDn78orbjcQ$NAtUZa1_60.#=z1chyIb0hj1FF(Int32 #=zHVE4QKE=, #=zyQ7xRVUnf1XuFJjGp6kU54zdiZNmN3Qp0w== #=zov9$WD8=)
at #=zzukH64qg$tm92KBZitvQtVDGlotw.#=zmVx0dNl2HehK()
at #=zzukH64qg$tm92KBZitvQtVDGlotw.#=zQN6cggQ=(AsyncCallback #=zwzsYyko=, Object #=z0CT2r0c=)
at Aspose.Email.Clients.Smtp.SmtpClient.BeginSend(IConnection connection, IEnumerable1 messages, EventHandler
1 messageSentDelegate, AsyncCallback callback, Object state)
at Aspose.Email.Clients.Smtp.SmtpClient.Send(IConnection connection, IEnumerable`1 messages)
at Aspose.Email.Clients.Smtp.SmtpClient.Send(MailMessage message)
Can you please help?
@GerhardTM
Thank you for the issue description. Could you share a simple standalone project or code snippet for reproducing and investigating the problem, please? Also, we need the original email file sample.
@Andrey_Potapov
Here’s a very simple code snippet for sending mail. In 20.11 it’s working, in 20.12 it’s broken:
MailMessage message = new MailMessage();
// Set From field, To field and Plain text body
message.From = "test@ekro.nl";
message.To.Add("test@ekro.nl");
message.Subject = "Test";
message.Body = "Test";
// Create an instance of the SmtpClient class
SmtpClient client = new SmtpClient();
// And Specify your mailing host server, Username, Password and Port
client.Host = "mailserver";
client.Port = 25;
client.UseAuthentication = true;
client.Username = @"username";
client.Password = @"password";
client.EnableLogger = true;
client.LogFileName = @"c:\temp\smtp.log";
client.SecurityOptions = SecurityOptions.Auto;
try
{
//Client.Send will send this message
client.Send(message);
Console.WriteLine("Message sent!");
Console.ReadLine();
}
catch (OperationCanceledException ex)
{
Trace.WriteLine(ex.ToString());
}
catch (Exception ex)
{
Trace.WriteLine(ex.ToString());
}
@GerhardTM,
Thank you for the code snippet. I have logged the issue in our tracking system with ID EMAILNET-40123. We will investigate it. I will let you know about any progress.
@Andrey_Potapov
I am also having similar issue while trying to send email using Gmail SMTP (less secure apps). With Aspose.Email, I got below exception:
System.OperationCanceledException: Operation has been canceled at #=z6olhBS5mdo7kVLXj3HJmqkdjzci7.#=zw5pCFvQ=(IAsyncResult #=zTdoZkRs=) at #=z6olhBS5mdo7kVLXj3HJmqkdjzci7.#=zXPKocRY=() at #=zF_HSqkCK8BRtzz_tOyhhWhNjSpxEpgYJ_BizSHg=.#=zQ62e6EQ=(#=zhLq$jjoVGoN9yCc2TI6DmCNDPny2ZXUPEg== #=zRTOTbc0=) at #=zF75usQvVFTMgKRdSFL2qBfPtzKln.#=z8QUl$DS0h6yQ(Int32 #=zHRxhCi8=, #=zhLq$jjoVGoN9yCc2TI6DmCNDPny2ZXUPEg== #=z_0vRPOY=) at #=z6olhBS5mdo7kVLXj3HJmqkdjzci7.#=z7p4P9ivDhmlE() at #=z6olhBS5mdo7kVLXj3HJmqkdjzci7.#=zY4oMFRo=(AsyncCallback #=zNho5yt8=, Object #=zQ4K1pBo=) at Aspose.Email.Clients.Smtp.SmtpClient.#=z0HTh0xI=(IConnection #=zwuYZhgk=, IEnumerable1 #=zdkmP6dU=, EventHandler
1 #=zqz01X5VlIfLn, AsyncCallback #=zNho5yt8=, Object #=zQ4K1pBo=) at Aspose.Email.Clients.Smtp.SmtpClient.Send(IConnection connection, IEnumerable`1 messages) at Aspose.Email.Clients.Smtp.SmtpClient.Send(MailMessage message)
When I tried to replace Aspose.Email with System.Net.Mail, I got below exception:
System.Net.Mail.SmtpException: Service not available, closing transmission channel. The server response was: concurrent connection limit in Avast exceeded(pass:0, processes:) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message)
Any ideas?
@salman.sarfraz,
It seems Avast antivirus prevents the connection.
@Andrey_Potapov
Thanks for sharing. I will check with server administrator about it. Thanks.
The issues you have found earlier (filed as EMAILNET-40123) have been fixed in this update.