spring send gmail

ScarletLina 2012-04-24

只要这样配置好久能使用gmail了

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
		<property name="host" value="smtp.gmail.com" />
		<property name="javaMailProperties">
			<props>
[color=red]				<prop key="mail.smtp.auth">true</prop>
				<prop key="mail.smtp.timeout">25000</prop>
				<prop key="mail.smtp.port">465</prop>
				<prop key="mail.smtp.socketFactory.port">465</prop>
				<prop key="mail.smtp.socketFactory.fallback">false</prop>
				<prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>[/color]
			</props>
		</property>
		<property name="username">
			<value>****</value> 
		</property>
		<property name="password">
			<value>***</value>
		</property>
	</bean>

相关推荐