Mlue系列<三>发送邮件
Mule提供一种方式发送和接收邮件,IMAP transport用于接收邮件,SMTP transport用于发送邮件.本文主要讲述使用smtp来发送邮件。
SMTP Transport提供一些属性设置。
|
属性 |
类型 |
目标 |
描述 |
|
to |
String |
connector, endpoint |
The recipient of the message |
|
subject |
String |
connector, endpoint |
The default message subject |
|
fromaddress |
String |
connector |
The from address |
|
from |
String |
endpoint |
The from address |
|
replyToAddresses |
String |
connector |
A comma-separated list of reply-to addresses |
|
replayTo |
String |
connector |
A comma-separated list of reply-to addresses |
|
ccAddresses |
String |
connector |
A comma-separated list of cc addresses |
|
cc |
String |
endpoint |
A comma-separated list of cc addresses |
- 发送信息到指定的邮箱(smtp-mule-config.xml)
1 <?xml version="1.0" encoding="UTF-8"?>
2 <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xmlns:spring="http://www.springframework.org/schema/beans"
5 xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
6 xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
7 xmlns:smtp="http://www.mulesource.org/schema/mule/smtp/2.2"
8 xsi:schemaLocation="
9 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
10 http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
11 http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
12 http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd
13 http://www.mulesource.org/schema/mule/smtp/2.2 http://www.mulesource.org/schema/mule/smtp/2.2/mule-smtp.xsd">
14
15 <stdio:connector name="StdioConnector" messageDelayTime="1000" promptMessage="Please enter something:" />
16
17 <model name="fileMode">
18 <service name="fileService">
19 <inbound>
20 <stdio:inbound-endpoint system="IN" connector-ref="StdioConnector" />
21 </inbound>
22 <outbound>
23 <pass-through-router>
24 <smtp:outbound-endpoint host="smtp.qq.com"
25 port="25" user="77030030" password="13554907529"
26 from="77030030@qq.com" to="chenxi20050927@yahoo.com.cn" subject="From126Mail" />
27 </pass-through-router>
28 </outbound>
29 </service>
30 </model>
31 </mule>
32
2 <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xmlns:spring="http://www.springframework.org/schema/beans"
5 xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
6 xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
7 xmlns:smtp="http://www.mulesource.org/schema/mule/smtp/2.2"
8 xsi:schemaLocation="
9 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
10 http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
11 http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
12 http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd
13 http://www.mulesource.org/schema/mule/smtp/2.2 http://www.mulesource.org/schema/mule/smtp/2.2/mule-smtp.xsd">
14
15 <stdio:connector name="StdioConnector" messageDelayTime="1000" promptMessage="Please enter something:" />
16
17 <model name="fileMode">
18 <service name="fileService">
19 <inbound>
20 <stdio:inbound-endpoint system="IN" connector-ref="StdioConnector" />
21 </inbound>
22 <outbound>
23 <pass-through-router>
24 <smtp:outbound-endpoint host="smtp.qq.com"
25 port="25" user="77030030" password="13554907529"
26 from="77030030@qq.com" to="chenxi20050927@yahoo.com.cn" subject="From126Mail" />
27 </pass-through-router>
28 </outbound>
29 </service>
30 </model>
31 </mule>
32
浙公网安备 33010602011771号