Question

I need a mail client library (IMAP and SMTP) for Windows Phone 8 or another alternative (like TcpClient, SslClient in Windows 8, but I don't get in Windows Phone 8). I google a lot. Please let me know any library or Article/Tutorial to implement IMAP and SMTP mail client on Windows Phone 8.

Thanks in Advance.

Was it helpful?

Solution

You can work with sockets in Windows Phone 8. Apparently there is a new Windows.Networking.Sockets API you can try using, but the classic one based on System.Net.Sockets should still work - here's an example.

You'd still have to implement IMAP and SMTP yourself though, unless some functionality already exists that we haven't spotted yet.

OTHER TIPS

I found SMTP client for WinRT which work for me

I found this link very useful for Windows phone 8.1

Make a class like MailManager in data model folder and add this line of code at the top of your class using Limilabs.Mail; also add this Mail.dll library to your project. Read more

StorageFile imageFile = ...;
StorageFile attachmentFile = ...;

MailBuilder builder = new MailBuilder();
builder.Html = @"Html with an image: <img src="" cid:lena@@example.com""="">";
MimeData image = await builder.AddVisual(imageFile);
image.ContentId = "lena@example.com";
await builder.AddAttachment(attachmentFile);
builder.To.Add(new MailBox("to@example.com"));
builder.From.Add(new MailBox("from@example.com"));
builder.Subject = "Subject";

IMail email = builder.Create();

using(Smtp smtp = new Smtp())
{
    await smtp.Connect("smtp.server.com");  // or ConnectSSL for SSL
    await smtp.UseBestLoginAsync("user", "password");

    await smtp.SendMessageAsync(email);                     

    await smtp.CloseAsync();   
}    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top