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

Free Support Forum - aspose.com

AsposeException while trying to send email

Hi,

I am trying to write a simple code to send an email. Below is sample code,


MailMessage mssg= new MailMessage("FromEmail@domain.com", "ToEmail@domain.com", “First Message from Java”, “Body”);
SmtpClient client = new SmtpClient(host, port, userName, password);
client.setSecurityOptions(SecurityOptions.Auto);
client.send(mssg);

I am using aspose-email-17.4.0-jdk16 jar file.
While running the code, I am getting below exceptions

Exception in thread “main” AsposeException
—> AsposeException
—> java.lang.NullPointerException
— End of inner exception stack trace —
[Ljava.lang.StackTraceElement;@19d37183
— End of inner exception stack trace —
[Ljava.lang.StackTraceElement;@1a0dcaa
at com.aspose.email.auh.a(SourceFile:159)
at com.aspose.email.gz.g(SourceFile:658)
at com.aspose.email.gz.B(SourceFile:590)
at com.aspose.email.gz.a(SourceFile:571)
at com.aspose.email.SmtpClient.a(SourceFile:1847)
at com.aspose.email.SmtpClient.a(SourceFile:1819)
at com.aspose.email.SmtpClient.send(SourceFile:1638)
at ExampleSend.checkMessageForward(ExampleSend.java:37)
at ExampleSend.main(ExampleSend.java:13)
Caused by: AsposeException
—> java.lang.NullPointerException
— End of inner exception stack trace —
[Ljava.lang.StackTraceElement;@fdefd3f
at com.aspose.email.auh.b(SourceFile:247)
at com.aspose.email.auh.a(SourceFile:24)
at com.aspose.email.aui.a(SourceFile:133)
at com.aspose.email.internal.af.h.a(Unknown Source)
at com.aspose.email.internal.af.j.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at com.aspose.email.internal.ei.c$a.a(SourceFile:529)
at com.aspose.email.internal.ei.c$a.(SourceFile:433)
at com.aspose.email.internal.ei.c.a(SourceFile:86)
at com.aspose.email.aio.a(SourceFile:53)
at com.aspose.email.auh.a(SourceFile:410)
at com.aspose.email.auh.a(SourceFile:377)
at com.aspose.email.auh.b(SourceFile:234)
… 5 more

Please help me to resolve this issue.

@ershad.ics3,

We have tested the sample code with the latest version of Aspose.Email for Java 17.8 and were not able to face any issue as you have mentioned. We have used Gmail test account for this purpose. Could you please give it a try at your end with this latest version and let us know your feedback? If the issue still persists, please share your environment details with us along with a test account credentials that we can use to investigate the issue further at our end.

This issue resolved now. Thanks!

@ershad.ics3,

Thank you for the feedback and feel free to write us back if you have any other query related to Aspose.Email.