<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value="${mail.host}"/> <property name="username" value="${mail.username}"/> <property name="password" value="${mail.password}"/> <property name="defaultEncoding" value="UTF-8"/> <property name="javaMailProperties"> <props> <prop key="mail.smtp.auth">${mail.smtp.auth}</prop> <prop key="mail.smtp.timeout">${mail.smtp.timeout}</prop> </props> </property> </bean> <bean id="templateMessage" class="org.springframework.mail.SimpleMailMessage"> <property name="from" value="${mail.from}"/> <property name="to" value="${mail.to}"/> <property name="subject" value="${mail.subject}"/> </bean>
######### Email config #########
mail.from=xx-dev@china.xx.com
mail.host=192.168.1.203
mail.smtp.auth=false
mail.smtp.timeout=25000
mail.username=
mail.password=
reference: http://static.springframework.org/spring/docs/2.5.x/reference/mail.html