How can I use POP3 to receive emails?

Source: Internet
Author: User

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

Pop3.Connect "username", "password", "pop3mail.intels.net"
'Pop3Connection username,Password, POP3Address.

Response. Write ("You have"& Pop3.count &"Email.<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
 'Obtain all recipients,And storage.

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: \ intels \ email \ attachments \" & at. Filename)
GetAttachments = getAttachments & "<a href =" "/intels/email/attachments/" & at. Filename & ""> "&_
At. FileName & "(" & at. Size & "bytes)" & "</a>" & separator
Next
End Function

'The above is the attachment for the program.,And save it to the server.,You can also return the attachment link..

%>
<Html>
<Body>
<TABLE>
<Tr>
<Td>Topic:Hi!! </Td>
<Td> <% = msg. Subject %> </td>
</Tr>
<Tr>
<Td>Sender:Li yingbing@ 163.net</td>
<Td> <% = msg. FromName %> </td>
</Tr>
<Tr>
<Td>Recipient:Song yanhao@ 163.net</td>
<Td> <% = ReTO %> </td>
</Tr>
<Tr>
<Td>CC:Shen Chaoyang@ 163.net</td>
<Td> <% = ReCC %> </td>
</Tr>
<Tr>
<Td>Attachment:Legend of dancing with the wind</Td>
<Td> <% = getAttachments %> </td>
</Tr>
<Tr>
<Td>Content:Uri wow, Uri wow ......</Td>
<Td> <pre> <% = msg. body %> </pre> </td>
</Tr>
</TABLE>
</Body>
<% End if
Pop3.Disconnect
%>

[1]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.