<?xml version= "1.0" encoding= "UTF-8"? ><beans xmlns= "Http://www.springframework.org/schema/beans" xmlns: Xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation= "Http://www.springframework.org/schema/beans Http://www.springframework.org/schema/beans/spring-beans.xsd "><!--This configuration file is mostly fixed, just find a template like this, Then know what each of the parameters in the meaning of the representative, according to the actual situation changes on the line .--><!--the object that sends the message is configured as a spring bean--><bean id= "MailSender" class= " Org.springframework.mail.javamail.JavaMailSenderImpl "><!--mail server host--><property name=" host "value=" Smtp.126.com "/><!--set user name--><property name=" username "value=" itcast0228 "/><!--Set Password-->< Property name= "Password" value= "0228itcast"/><!--Mail Properties--><property name= "Javamailproperties" ><!- -Say this props tag and now use this props tag in two files--><!--<property name= "Hibernateproperties" > One is in applicationcontext.xml about configuring <props><prop key= "Hibernate.dialect" > Org.hibernate.dialect.mysqldialect</prop><prop key="Hibernate.show_sql" >true</prop><prop key= "Hibernate.format_sql" >false</prop></props >--><props><!--Enable authentication--><prop key= "Mail.smtp.auth" >true</prop><!--SMTP Protocol encryption Method-- ><prop key= "mail.smtp.starttls.enable" >true</prop><!--Time Out--><prop key= " Mail.smtp.timeout ">10000</prop></props></property></bean></beans>
Applicationcontext-mail.xml templates