开发者

How to connect to mail server and retrieve mails?

开发者 https://www.devze.com 2023-01-13 15:36 出处:网络
I have mail server configuration data (s开发者_运维技巧erver - user name - password - port) and i want to access it using vb.net and retrieve its mails in collection.

I have mail server configuration data (s开发者_运维技巧erver - user name - password - port) and i want to access it using vb.net and retrieve its mails in collection. i need to parse the email body to make some operations on it.

please i need some help, i tried to search for it but i found a complex samples.


Try to use this library, it is very suitable for that http://csharpmail.codeplex.com/


It is possible to connect to the mail server using IMAP, check the following urls

http://www.example-code.com/vbdotnet/imap_readMail.asp http://www.codeproject.com/Messages/3146060/connecting-gmail-using-IMAP-in-VB-NET.aspx http://www.aspnetimap.com/examples.aspx

more examples at http://www.example-code.com/vbdotnet/imap.asp

Have a nice time


You may also want to try Mail.dll email component:

Using imap As New Imap
    imap.Connect("imap.server.com")
    imap.Login("user", "password")

    imap.SelectInbox()
    Dim uidList As List(Of Long) = imap.SearchFlag(Flag.Unseen)

    For Each uid As Long In uidList
        Dim email As IMail = New MailBuilder() _
            .CreateFromEml(imap.GetMessageByUID(uid))
        Console.WriteLine(email.Subject)
    Next
    imap.Close(True)
End Using   

Please note that this is a commercial product I developed.

You can download it here: https://www.limilabs.com/mail

0

精彩评论

暂无评论...
验证码 换一张
取 消