Spring XML Configuration <!--Email--<bean id= "MailSender" class= "org.springframework.mail.javamail.JavaMailSend Erimpl "> <property name=" host "value=" smtp.exmail.qq.com "/> <property name=" port "value=" 465 "/ > <property name= "username" value= "xxxxxxx"/> <property name= "password" value= "xxxx"/> <property name= "Javamailproperties" > <props> <prop key= "Mail.debug" >TRUE</PR op> <prop key= "Mail.transport.protocol" >smtp</prop> <prop key= "MAIL.SMTP. Auth ">true</prop> <prop key=" mail.smtp.starttls.enable ">true</prop> &L T;prop key= "mail.smtp.ssl.enable" >true</prop> <!--whether to start ssl--> <prop key= "Mail.from" >xx Xxx</prop> </props> </property> </bean>controller Part code &NBSP;&NBSP;&NBSP;&NBSP ; ///Verify that it is mailbox if (Phonenum.matches (" \\w+ ([-+.] \\w+) *@\\w+ ([-.] \\w+) *\\.\\w+ ([-.] \\w+) { simplemailmessage mailmessage =new simplemailmessage (); Mailmessage.setto (Phonenum); Accept email mailmessage.setsubject ( Codes.verificationcode); Topics mailmessage.settext ( Codes.verificationcode+ ":" +verificationcode); Content mailsender.send (mailmessage); Send }
Spring Send Email