01 |
|
02 |
03 | < beans xmlns = "http://www.springframework.org/schema/beans" |
04 | xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" |
05 | xmlns:p = "http://www.springframework.org/schema/p" |
06 | xmlns:aop = "http://www.springframework.org/schema/aop" |
07 | xmlns:context = "http://www.springframework.org/schema/context" |
08 | xmlns:jee = "http://www.springframework.org/schema/jee" |
09 | xmlns:task = "http://www.springframework.org/schema/task" |
10 | xsi:schemaLocation=" |
11 | http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd |
12 | http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd |
13 | http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd |
14 | http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd |
15 | http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd |
16 | http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" |
17 | > |
18 |
19 | < context:component-scan base-package = "com.javacodegeeks.spring.mail" /> |
20 | |
21 | < bean id = "mailSender" class = "org.springframework.mail.javamail.JavaMailSenderImpl" > |
22 | < property name = "host" value = "smtp.gmail.com" /> |
23 | < property name = "port" value = "25" /> |
24 | < property name = "username" value = "myusername@gmail.com" /> |
25 | < property name = "password" value = "mypassword" /> |
26 | < property name = "javaMailProperties" > |
27 | < props > |
28 |
|
29 | < prop key = "mail.transport.protocol" >smtp prop > |
30 |
|
31 | < prop key = "mail.smtp.auth" >true prop > |
32 |
|
33 | < prop key = "mail.smtp.starttls.enable" >true prop > |
34 | < prop key = "mail.debug" >true prop > |
35 |
props > |
36 |
property > |
37 |
bean > |
38 | |
39 | < bean id = "alertMailMessage" class = "org.springframework.mail.SimpleMailMessage" > |
40 | < property name = "from" > |
41 | < value >myusername@gmail.com value > |
42 |
property > |
43 | < property name = "to" > |
44 | < value >myusername@gmail.com value > |
45 |
property > |
46 | < property name = "subject" value = "Alert - Exception occurred. Please investigate" /> |
47 |
bean > |
48 | |
49 |
beans > |
Read more: Java Code Geeks: Sending e-mails in Java with Spring – GMail SMTP server example http://www.javacodegeeks.com/2010/07/java-mail-spring-gmail-smtp.html#ixzz0vF2cGLgT
No comments:
Post a Comment