1 Set pop3 = Server.CreateObject( "JMail.POP3" )
2
3'pop3的连接用户名,密码,pop3地址
4pop3.Connect "username", "password", "mail.mydomain.com"
5
6Response.Write( "你有" & pop3.count & " 封邮件。
<br/>
<br/>
1" )
2
3if pop3.count > 0 then
4Set msg = pop3.Messages.item(1)
5ReTo = ""
6ReCC = ""
7
8Set Recipients = msg.Recipients
9separator = ", "
10
11' 现在得到所有的收件人,并且存储
12
13For i = 0 To Recipients.Count - 1
14If i = Recipients.Count - 1 Then
15separator = ""
16End If
17
18Set re = Recipients.item(i)
19If re.ReType = 0 Then
20ReTo = ReTo & re.Name & " (
<a &"""="" href="" mailto:"&="" re.email="">" & re.EMail & "</a>
1)" & separator
2else
3ReCC = ReTo & re.Name & " (
<a &"""="" href="" mailto:"&="" re.email="">" & re.EMail & "</a>
1)" & separator
2End If
3Next
4
5'这个程序得到附件,并且保存到服务器的硬盘上。也可以返回附件的详细连接
6Function getAttachments()
7Set Attachments = msg.Attachments
8separator = ", "
9
10For i = 0 To Attachments.Count - 1
11If i = Attachments.Count - 1 Then
12separator = ""
13End If
14
15Set at = Attachments(i)
16at.SaveToFile( "c:\EMail\attachments\" & at.Filename )
17getAttachments = getAttachments & "
<a "="" &="" &"""="" at.filename="" attachments="" email="" href="">" &_
at.FileName & "(" & at.Size & " bytes)" & "</a>
1" & separator
2Next
3End Function
4
1<html>
2<body>
3<table>
4<tr>
5<td>邮件标题</td>
6<td>```
7= msg.Subject
8```</td>
9</tr>
10<tr>
11<td>发件人</td>
12<td>```
13= msg.FromName
14```</td>
15</tr>
16<tr>
17<td>收件人</td>
18<td>```
19= ReTO
20```</td>
21</tr>
22<tr>
23<td>抄送</td>
24<td>```
25= ReCC
26```</td>
27</tr>
28<tr>
29<td>附件</td>
30<td>```
31= getAttachments
32```</td>
33</tr>
34<tr>
35<td>内容</td>
36<td><pre>```
37= msg.Body
38```</pre></td>
39</tr>
40</table>
41</body>
42</html>
1 end if
2
3pop3.Disconnect
4