繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> 邮件相关 >> jmail4.1用pop3收信的例子

jmail4.1用pop3收信的例子

2006-08-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:  
关键字:例子 jmail pop3 4.1

  

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

'pop3的连接用户名,密码,pop3地址

pop3.Connect "username", "password", "mail.mydomain.com"

Response.Write( "你有" & pop3.count & " 封邮件。

" )

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 & " (" & re.EMail & ")" &

separator

else

ReCC = ReTo & re.Name & " (" & re.EMail & ")" &

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 & "" &_

at.FileName & "(" & at.Size & " bytes)" & "" & separator

Next

End Function

%>

邮件标题 <%= msg.Subject %>
发件人 <%= msg.FromName %>
收件人 <%= ReTO %>
抄送 <%= ReCC %>
附件 <%= getAttachments %>
内容
<%= msg.Body %>

<% end if

pop3.Disconnect

%>

责任编辑:admin
相关文章