I wanted to update our product from Aspose Email version 23.3 to the latest 23.11 and noticed a problem. Since 23.7, it seems sending a MailMessage with SmtpClient throws an Exception.
Stack-Trace (using version 23.11):
SmtpException: Failure sending mail.
[Ljava.lang.StackTraceElement;@66d3eec0
at com.aspose.email.zbdm.g(SourceFile:418)
at com.aspose.email.zbdm.a(SourceFile:222)
at com.aspose.email.zzv.e(SourceFile:208)
at com.aspose.email.zzv.a(SourceFile:30)
at com.aspose.email.zzw.a(SourceFile:46)
at com.aspose.email.zbit.a(SourceFile:101)
at com.aspose.email.internal.ah.zd.a(SourceFile:65)
at com.aspose.email.internal.ah.ze.run(SourceFile:117)
I’m using this code snippet to test the behavior:
MailMessage message = new MailMessage();
MailAddressCollection mac = new MailAddressCollection();
mac.addMailAddress(new MailAddress("..."));
MailAddressCollection rpt = new MailAddressCollection();
rpt.addMailAddress(new MailAddress("..."));
message.setFrom(new MailAddress("..."));
message.setSender(new MailAddress("..."));
message.setTo(mac);
message.setReplyToList(rpt);
message.setSubject("ASPOSE - Test-Mail");
message.setBody("");
message.setHtmlBody("<html><body>This is the Html body</body></html>");
message.setDeliveryNotificationOptions(DeliveryNotificationOptions.OnSuccess);
SmtpClient client = new SmtpClient();
ConfigureSmtpClient(client);
try {
client.send(message);
} catch (Exception ex) {
ex.printStackTrace();
}
Same code works with version 23.6 and prior versions. I’m not sure if I’m missing something, but I did not see anything that looks relevant to this in the 23.7 changelog. Can you please investigate this and let me know if I’m doing something wrong?