首页 > 互联资讯 > 技术交流  > 

如何用POP3接收电子邮件?

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

pop3.Connect "username", "password", "pop3mail.intels.net"
' POP3
的连接用户名,密码,POP3地址.

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:intelsemailattachments" & at.Filename )
getAttachments = getAttachments & "" &_
at.FileName & "(" & at.Size & " bytes)" & "
" & separator
Next
End Function

' 以上是程序得到附件,并保存到服务器上,也可返回附件链接.

%>



























主题:撼雪喷云向你问好! <%= msg.Subject %>
发件人:李雁冰@163.net <%= msg.FromName %>
收件人:宋颜浩@163.net <%= ReTO %>
抄送:申朝阳@163.net <%= ReCC %>
附件:随风起舞的传说 <%= getAttachments %>
内容:乌里哇啦乌里哇啦……
<%= msg.body %>



<% end if
pop3.Disconnect
%>

[1]

如何用POP3接收电子邮件?由讯客互联技术交流栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“如何用POP3接收电子邮件?