others-how to solve smtp 501 exception sender address must contain a domain
1. The purpose of this post
I would demo how to solve this error when using java to send SMTP mail:
Because we use the following code to send SMTP mail:
Here the value of _from is filled with value ‘xxxuser’, some of the SMTP service providers require this field to be a real email address, so we change the _from value from ‘xxxuser’ to ‘[email protected]’, the problem solved.
4. Solution and Code
Make sure you have a valid email address to be used as the ‘from’ address of the mail.