jmail4.1用pop3收信的例子

jmail4.1用pop3收信的例子

【caoli】 于 2000-12-22 17:24:14 加贴在 Joy ASP ↑:

<% Set pop3 = Server.CreateObject( "JMail.POP3" )

'pop3的连接用户名,密码,pop3地址 
pop3.Connect "username", "password", "mail.mydomain.com"

Response.Write( "你有" & pop3.count & " 封邮件。<br><br>" )

if pop3.count > 0 then 
Set msg = pop3.Messages.item(1) 
ReTo = "" 
ReCC = ""

Set Recipients = msg.Recipients 
separator = ", "

' 现在得到所有的收件人,并且存储

For i = 0 To Recipients.Count - 1 
If i = Recipients.Count - 1 Then 
separator = "" 
End If

Set re = Recipients.item(i) 
If re.ReType = 0 Then 
ReTo = ReTo & re.Name & " (<a href=""mailto:"& re.EMail &""">" & re.EMail & "</a>)" & 
separator 
else 
ReCC = ReTo & re.Name & " (<a href=""mailto:"& re.EMail &""">" & re.EMail & "</a>)" & 
separator 
End If 
Next

'这个程序得到附件,并且保存到服务器的硬盘上。也可以返回附件的详细连接 
Function getAttachments() 
Set Attachments = msg.Attachments 
separator = ", "

For i = 0 To Attachments.Count - 1 
If i = Attachments.Count - 1 Then 
separator = "" 
End If

Set at = Attachments(i) 
at.SaveToFile( "c:\EMail\attachments\" & at.Filename ) 
getAttachments = getAttachments & "<a href=""/EMail/attachments/" & at.Filename &""">" &_ 
at.FileName & "(" & at.Size & " bytes)" & "</a>" & separator 
Next 
End Function

%> 
<html> 
<body> 
<TABLE> 
<tr> 
<td>邮件标题</td> 
<td><%= msg.Subject %></td> 
</tr> 
<tr> 
<td>发件人</td> 
<td><%= msg.FromName %></td> 
</tr> 
<tr> 
<td>收件人</td> 
<td><%= ReTO %></td> 
</tr> 
<tr> 
<td>抄送</td> 
<td><%= ReCC %></td> 
</tr> 
<tr> 
<td>附件</td> 
<td><%= getAttachments %></td> 
</tr> 
<tr> 
<td>内容</td> 
<td><pre><%= msg.Body %></pre></td> 
</tr> 
</TABLE> 
</body> 
</html>

<% end if

pop3.Disconnect

%>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值