In development, because you want to use multiple email accounts to log on and send emails, that is, the Email recipients are different. In this regard, the login account is considered as the sender. In fact, you can set the sender by yourself. Let's take a look at a simple text email.Code:
Simpleemail = new simpleemail (); simpleemail. sethostname (constant. email_host_name); simpleemail. setsmtpport (25); simpleemail. setauthentication (constant. email_user_name, constant. email_user_pass); try {simpleemail. addto (email); simpleemail. setfrom (constant. email_user_name); simpleemail. setsubject (subject); simpleemail. setcharset ("UTF-8"); simpleemail. setmsg (content); simpleemail. send (); logger. error ("sent successfully:" + email);} catch (emailexception e) {e. printstacktrace (); throw new serviceexception (E. getmessage ());}
In the above Code:Simpleemail. setfrom (constant. email_user_name );This line controls the sender. Take a closer look at the specific email sending mechanism.Source code.
You can set the sender at will, which means you can forge the sender and send the email. It's a bit scary. I don't know how to prevent this situation.