Author Archives: admin

Sending emails from your Android, iOS, or Windows Mobile Devices with Ultimate Mail for Mobile

You can easily send emails from your mobile devices with just a few lines of C# code. From version 6.0 Ultimate Mail also includes support for Android and iOS platforms in addition to Windows, Linux and MAC OS X with .NET Framework and Mono.

With Ultimate Mail you can load your messages in EML or Outlook format using the same Load method. This is the screenshot of an example to load message from templates and send emails on iOS:

Mail-Template-iOS

This is the screenshot of an example to send emails on Android:

SMTP Config

The following code snippet is taken from an example for iOS to send emails:

Smtp client = null;
try
{
client = new Smtp ();
await client.ConnectAsync(ServerName, ServerPort, Mode);
}
catch (Exception ex)
{
_window.Busy = false;
Util.ShowException(ex);
return;
}

if (!string.IsNullOrEmpty(UserName))
{
try
{
await client.AuthenticateAsync(UserName, Password);
}
catch (Exception ex)
{
_window.Busy = false;
Util.ShowException(ex);
return;
}
}

try
{
await client.SendAsync(_message);
}
catch (Exception ex)
{
_window.Busy = false;
Util.ShowException(ex);
return;
}

IMAP, POP3 and SMTP Settings for Yahoo! Mail

Yahoo! IMAP, POP3 and SMTP connections dont require SSL enabled. The following table shows the available settings to establish connections to Yahoo! Mail servers:

Protocol Port Security Mode Server
IMAP 143
993
143
Unsecure
Implicit
Explicit
imap.mail.yahoo.com
POP3 110
995
110
Unsecure
Implicit
Explicit
pop.mail.yahoo.com
SMTP 587
465
Unsecure
Implicit
smtp.mail.yahoo.com

The following example code show you how to connect Yahoo! Mail Servers:

// Create a new instance of the ImapClient class and download a message.
using (ImapClient client = new ImapClient())
{
// Connect to the server.
client.Connect("imap.mail.yahoo.com", 993, SecurityMode.Implicit);
// Login to the server.
client.Authenticate("mytest@yahoo.com", "password");

// Download a message to an instance of the MailMessage class.
MailMessage msg = client.DownloadMailMessage(imapMessageUniqueId);
}

// Create a new instance of the Pop3Client class and download a message.
using (Pop3Client client = new Pop3Client())
{
// Connect to the server.
client.Connect("pop.mail.yahoo.com", 995, SecurityMode.Implicit);
// Login to the server.
client.Authenticate("mytest@yahoo.com", "password");

// Download the message to an instance of the MailMessage class.
MailMessage msg = client.DownloadMailMessage(pop3MessageSequenceNumber);
}

// Create a new instance of the SmtpClient class and send an email.
using (SmtpClient client = new SmtpClient())
{
// Connect to the server.
client.Connect("smtp.mail.yahoo.com", 587);
// Login to the server.
client.Authenticate("mytest@yahoo.com", "password");

// Create a new mail message.
MailMessage msg = new MailMessage();
msg.Subject = "Test Subject";
msg.BodyText = "Content";
msg.From = "from@mydomain.com";
msg.To = "to@somedomain.com";
// And send it.
client.Send(msg);
}