<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog &#124; Limilabs &#187; SMTP</title>
	<atom:link href="http://www.limilabs.com/blog/tag/smtp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.limilabs.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 21 May 2012 09:49:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Send vCard business card</title>
		<link>http://www.limilabs.com/blog/send-vcard-business-card?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=send-vcard-business-card</link>
		<comments>http://www.limilabs.com/blog/send-vcard-business-card#comments</comments>
		<pubDate>Sat, 10 Mar 2012 18:53:04 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[vCard]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2548</guid>
		<description><![CDATA[Mail.dll .NET email component makes sending vCard business cards easy. MailBuilder class contains AddVCard method, that can be used to add vCard business card as a attachment to your email. You can use VCard class to create VCARD business card. It provides easy to use API to add phone, email and address information. Here&#8217;s the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.limilabs.com/mail">Mail.dll .NET email component</a> makes sending vCard business cards easy.</p>
<p><em>MailBuilder</em> class contains <em>AddVCard</em> method, that can be used to add vCard business card as a attachment to your email.<br />
You can use <em>VCard</em> class to create VCARD business card. It provides easy to use API to add phone, email and address information.</p>
<p>Here&#8217;s the simple sample showing how to send email with VCard business card:</p>
<pre class="brush: csharp;">
// C#

// Create VCard business card

VCard vCard = new VCard();

vCard.FullName = &quot;John Doe&quot;;
vCard.Name = new VCardName(&quot;John&quot;, &quot;Doe&quot;);
vCard.Organization = new VCardOrganization(&quot;Example&quot;);
vCard.Title = &quot;CEO&quot;;
vCard.Url = &quot;http://www.example.com&quot;;

VCardEmail workEmail = new VCardEmail(&quot;john.doe@example.com&quot;);
workEmail.MarkWork();
workEmail.MarkPreferred();
vCard.Emails.Add(workEmail);

VCardEmail homeEmail = new VCardEmail(&quot;john.doe@gmail.com&quot;);
homeEmail.MarkHome();
vCard.Emails.Add(homeEmail);

VCardAddress workAddress = new VCardAddress(&quot;&quot;, &quot;&quot;, &quot;501 E. Middlefield Rd.&quot;, &quot;Mountain View&quot;, &quot;CA&quot;, &quot;94043&quot;, &quot;U.S.A.&quot;);
workAddress.MarkWork();
vCard.Addresses.Add(workAddress);

VCardAddress homeAddress = new VCardAddress(&quot;&quot;, &quot;&quot;, &quot;6544 Battleford Drive&quot;, &quot;Raleigh&quot;, &quot;NC&quot;, &quot;27613-3502&quot;, &quot;U.S.A.&quot;);
homeAddress.MarkHome();
vCard.Addresses.Add(homeAddress);

VCardPhone homePhone = new VCardPhone(&quot;+1-919-676-9515&quot;);
homePhone.MarkHome();
vCard.Phones.Add(homePhone);

VCardPhone workPhone = new VCardPhone();
workPhone.AsUri(&quot;tel:+1-919-676-9564&quot;);
workPhone.MarkWork();
workPhone.MarkFax();
workPhone.MarkVoice();
vCard.Phones.Add(workPhone);

// Create email message

MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox(&quot;john.doe@example.com&quot;));
builder.To.Add(new MailBox(&quot;bob@example.com&quot;));
builder.Text = &quot;Business card&quot;;
builder.Text = &quot;Here's my business card.&quot;;
builder.AddVCard(vCard);
IMail email = builder.Create();

// Send email message using SMTP protocol

using(Smtp smtp  = new Smtp())
{
    smtp.ConnectSSL(&quot;imap.example.com&quot;);
    smtp.UseBestLogin(&quot;user&quot;, &quot;password&quot;);
    smtp.SendMessage(email);
    smtp.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET

' Create VCard business card

Dim vCard As New VCard()

vCard.FullName = &quot;John Doe&quot;
vCard.Name = New VCardName(&quot;John&quot;, &quot;Doe&quot;)
vCard.Organization = New VCardOrganization(&quot;Example&quot;)
vCard.Title = &quot;CEO&quot;
vCard.Url = &quot;http://www.example.com&quot;

Dim workEmail As New VCardEmail(&quot;john.doe@example.com&quot;)
workEmail.MarkWork()
workEmail.MarkPreferred()
vCard.Emails.Add(workEmail)

Dim homeEmail As New VCardEmail(&quot;john.doe@gmail.com&quot;)
homeEmail.MarkHome()
vCard.Emails.Add(homeEmail)

Dim workAddress As New VCardAddress(&quot;&quot;, &quot;&quot;, &quot;501 E. Middlefield Rd.&quot;, &quot;Mountain View&quot;, &quot;CA&quot;, &quot;94043&quot;, _
	&quot;U.S.A.&quot;)
workAddress.MarkWork()
vCard.Addresses.Add(workAddress)

Dim homeAddress As New VCardAddress(&quot;&quot;, &quot;&quot;, &quot;6544 Battleford Drive&quot;, &quot;Raleigh&quot;, &quot;NC&quot;, &quot;27613-3502&quot;, _
	&quot;U.S.A.&quot;)
homeAddress.MarkHome()
vCard.Addresses.Add(homeAddress)

Dim homePhone As New VCardPhone(&quot;+1-919-676-9515&quot;)
homePhone.MarkHome()
vCard.Phones.Add(homePhone)

Dim workPhone As New VCardPhone()
workPhone.AsUri(&quot;tel:+1-919-676-9564&quot;)
workPhone.MarkWork()
workPhone.MarkFax()
workPhone.MarkVoice()
vCard.Phones.Add(workPhone)

' Create email message

Dim builder As New MailBuilder()
builder.From.Add(New MailBox(&quot;john.doe@example.com&quot;))
builder.[To].Add(New MailBox(&quot;bob@example.com&quot;))
builder.Text = &quot;Business card&quot;
builder.Text = &quot;Here's my business card.&quot;
builder.AddVCard(vCard)
Dim email As IMail = builder.Create()

' Send email message using SMTP protocol

Using smtp As New Smtp()
	smtp.ConnectSSL(&quot;imap.example.com&quot;)
	smtp.UseBestLogin(&quot;user&quot;, &quot;password&quot;)
	smtp.SendMessage(email)
	smtp.Close()
End Using
</pre>
<p>Such <a href="http://www.limilabs.com/blog/receive-vcard-business-card">email can be parsed and VCard extracted</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/send-vcard-business-card/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send iCalendar meeting requests for different timezone</title>
		<link>http://www.limilabs.com/blog/send-icalendar-meeting-requests-for-different-timezone?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=send-icalendar-meeting-requests-for-different-timezone</link>
		<comments>http://www.limilabs.com/blog/send-icalendar-meeting-requests-for-different-timezone#comments</comments>
		<pubDate>Sun, 01 Jan 2012 14:18:57 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[iCalendar]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=1842</guid>
		<description><![CDATA[Usually you define time of an event in relation to UTC time zone. If you need to define event on 9:00 o&#8217;clock in Alaska you simply need to subtract 9 hours from event time to get the event time in UTC (18:00:00). 18 &#8211; 9 = 9. It all works great in December (Alaska is [...]]]></description>
			<content:encoded><![CDATA[<p>Usually you define time of an event in relation to UTC time zone.</p>
<p>If you need to define event on 9:00 o&#8217;clock in Alaska you simply need to subtract 9 hours from event time to get the event time in UTC<br />
(18:00:00). 18 &#8211; 9 = 9.</p>
<p>It all works great in December (Alaska is UTC-9), but in May, <strong>daylight saving time is in effect</strong> in Alaska (Alaska is UTC-8 then).</p>
<p>If the event is recurring, in May, event is going to be held on 10:00 Alaska time (18 &#8211; 8 = 10). Which is most likely not what you want.</p>
<p>As the time zones in different parts of world change way to often to reflect these changes in Mail.dll, you&#8217;ll need to specify the time zone when creating new event (including the daylight savings time).</p>
<p>Here&#8217;s the sample:</p>
<pre class="brush: csharp;">
// C#
using Fluent = Limilabs.Mail.Fluent;
using Limilabs.Client.SMTP;
using Limilabs.Mail;
using Limilabs.Mail.Appointments;

Appointment appointment = new Appointment();

// Create time zone
VTimeZone alaska = appointment.AddTimeZone();
alaska.TimeZoneId = &quot;America/Anchorage&quot;;

// Define standard time offset
var standardRecurring = new RecurringRule();
standardRecurring.Frequency = Frequency.Yearly;
standardRecurring.ByDay.Add(Weekday.Sunday);
standardRecurring.ByMonths.Add(11);

var standard = new StandardOffset
{
    Name = &quot;AKST&quot;,
    Start = new DateTime(1970, 11, 01, 02, 00, 00),
    OffsetFrom = TimeSpan.FromHours(-8),
    OffsetTo = TimeSpan.FromHours(-9),
    RecurringRule = standardRecurring
};

// Define daylight time offset
var daylightRecurring = new RecurringRule();
daylightRecurring.Frequency = Frequency.Yearly;
daylightRecurring.ByDay.Add(new Weekday(2, Weekday.Sunday));
daylightRecurring.ByMonths.Add(3);

var daylight = new DaylightOffset
{
    Name = &quot;AKDT&quot;,
    Start = new DateTime(1970, 03, 08, 02, 00, 00),
    OffsetFrom = TimeSpan.FromHours(-9),
    OffsetTo = TimeSpan.FromHours(-8),
    RecurringRule = daylightRecurring
};

alaska.Standard.Add(standard);
alaska.Daylight.Add(daylight);

// Define event
Event e = appointment.AddEvent();
e.Start = new DateTime(2007, 08, 17, 12, 00, 00);
e.End = new DateTime(2007, 08, 17, 12, 30, 00);
e.Summary = &quot;At noon in Alaska&quot;;
e.InTimeZone(alaska);

e.SetOrganizer(new Person(&quot;Alice&quot;, &quot;alice@example.org&quot;));

e.AddParticipant(new Participant(
    &quot;Bob&quot;, &quot;bob@example.org&quot;, ParticipationRole.Required, true));
e.AddParticipant(new Participant(
    &quot;Tom&quot;, &quot;tom@example.org&quot;, ParticipationRole.Optional, true));
e.AddParticipant(new Participant(
    &quot;Alice&quot;, &quot;alice@example.org&quot;, ParticipationRole.Required, true));

Alarm alarm = e.AddAlarm();
alarm.BeforeStart(TimeSpan.FromMinutes(15));

IMail email = Fluent.Mail
    .Text(&quot;Status meeting at noon in Alaska.&quot;)
    .Subject(&quot;Status meeting&quot;)
    .From(&quot;alice@example.org&quot;)
    .To(&quot;bob@example.org&quot;)
    .To(&quot;tom@example.org&quot;)
    .AddAppointment(appointment)
    .Create();

using (Smtp smtp = new Smtp())
{
    smtp.Connect(&quot;smtp.example.org&quot;); // or ConnectSSL
    smtp.UseBestLogin(&quot;user&quot;, &quot;password&quot;);
    smtp.SendMessage(email);
    smtp.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET
Imports Fluent = Limilabs.Mail.Fluent
Imports Limilabs.Client.SMTP
Imports Limilabs.Mail
Imports Limilabs.Mail.Appointments

Dim appointment As New Appointment()

' Create time zone
Dim alaska As VTimeZone = appointment.AddTimeZone()
alaska.TimeZoneId = &quot;America/Anchorage&quot;

' Define standard time offset
Dim standardRecurring = New RecurringRule()
standardRecurring.Frequency = Frequency.Yearly
standardRecurring.ByDay.Add(Weekday.Sunday)
standardRecurring.ByMonths.Add(11)

Dim standard = New StandardOffset() With { _
	.Name = &quot;AKST&quot;, _
	.Start = New DateTime(1970, 11, 1, 2, 0, 0), _
	.OffsetFrom = TimeSpan.FromHours(-8), _
	.OffsetTo = TimeSpan.FromHours(-9), _
	.RecurringRule = standardRecurring _
}

' Define daylight time offset
Dim daylightRecurring = New RecurringRule()
daylightRecurring.Frequency = Frequency.Yearly
daylightRecurring.ByDay.Add(New Weekday(2, Weekday.Sunday))
daylightRecurring.ByMonths.Add(3)

Dim daylight = New DaylightOffset() With { _
	.Name = &quot;AKDT&quot;, _
	.Start = New DateTime(1970, 3, 8, 2, 0, 0), _
	.OffsetFrom = TimeSpan.FromHours(-9), _
	.OffsetTo = TimeSpan.FromHours(-8), _
	.RecurringRule = daylightRecurring _
}

alaska.Standard.Add(standard)
alaska.Daylight.Add(daylight)

' Define event
Dim e As [Event] = appointment.AddEvent()
e.Start = New DateTime(2007, 8, 17, 12, 0, 0)
e.[End] = New DateTime(2007, 8, 17, 12, 30, 0)
e.Summary = &quot;At noon in Alaska&quot;
e.InTimeZone(alaska)

e.SetOrganizer(New Person(&quot;Alice&quot;, &quot;alice@example.org&quot;))

e.AddParticipant(New Participant( _
	&quot;Bob&quot;, &quot;bob@example.org&quot;, ParticipationRole.Required, True))
e.AddParticipant(New Participant( _
	&quot;Tom&quot;, &quot;tom@example.org&quot;, ParticipationRole.[Optional], True))
e.AddParticipant(New Participant( _
	&quot;Alice&quot;, &quot;alice@example.org&quot;, ParticipationRole.Required, True))

Dim alarm As Alarm = e.AddAlarm()
alarm.BeforeStart(TimeSpan.FromMinutes(15))

Dim email As IMail = Fluent.Mail _
	.Text(&quot;Status meeting at noon in Alaska.&quot;) _
	.Subject(&quot;Status meeting&quot;) _
	.From(&quot;alice@example.org&quot;) _
	.[To](&quot;bob@example.org&quot;) _
	.[To](&quot;tom@example.org&quot;) _
	.AddAppointment(appointment) _
	.Create()

Using smtp As New Smtp()
	smtp.Connect(&quot;smtp.example.org&quot;) 	' or ConnectSSL
	smtp.UseBestLogin(&quot;user&quot;, &quot;password&quot;)
	smtp.SendMessage(email)
	smtp.Close()
End Using
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/send-icalendar-meeting-requests-for-different-timezone/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reply to an email</title>
		<link>http://www.limilabs.com/blog/reply-to-email?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reply-to-email</link>
		<comments>http://www.limilabs.com/blog/reply-to-email#comments</comments>
		<pubDate>Wed, 28 Dec 2011 09:53:34 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2188</guid>
		<description><![CDATA[You can use Mail.dll to easy reply to an HTML and plain-text emails. ReplyBuilder class allows you to specify custom HTML and plain-text reply templates. Mail.dll will parse HTML, extract body part, and build-in template engine will do the rest to create nicely formatted reply with all attachments, To and Cc fields set. The next [...]]]></description>
			<content:encoded><![CDATA[<p>You can use Mail.dll to easy reply to an HTML and plain-text emails.</p>
<p><em>ReplyBuilder </em>class allows you to specify <strong>custom HTML and plain-text reply templates</strong>. Mail.dll will parse HTML, extract body part, and build-in template engine will do the rest to create nicely formatted reply with all attachments, To and Cc fields set.</p>
<p>The next great thing is that plain-text version of the email is generated automatically.</p>
<p><img src="http://www.limilabs.com/blog/wp-content/uploads/2011/12/reply.png" alt="" title="reply" width="429" height="388" class="aligncenter size-full wp-image-2197" /></p>
<p>You can also take advantage of <em>ReplyAll </em>method that makes it easy to reply to all: senders of the message and all To and Cc recipients</p>
<p>In our example we’ll use Mail.dll <a href="http://www.limilabs.com/mail">IMAP client</a> to download first message from an IMAP server. Then we’ll use <em>ReplyBuilder  </em> to create a reply email message. Finally we’ll use Mail.dll SMTP client to send this message.</p>
<pre class="brush: csharp;">
// C#

IMail original = GetFirstMessage();

ReplyBuilder replyBuilder = original.Reply();
// You can specify your own custom template:
replyBuilder.HtmlReplyTemplate =
    &quot;[Html]&quot; +
    &quot;&lt;br /&gt;&lt;br /&gt;&quot; +
    &quot;On [Original.Date] [Original.Sender.Name] wrote:&quot; +
    &quot;&lt;blockquote &quot; +
        &quot;style='margin-left: 1em; &quot; +
        &quot;padding-left: 1em; &quot; +
        &quot;border-left: 1px #ccc solid;'&gt;&quot; +
    &quot;[QuoteHtml]&quot; +
    &quot;&lt;/blockquote&gt;&quot;;

replyBuilder.Html =
    &quot;Alice, &lt;br/&gt;&lt;br/&gt;thanks for your email.&quot;;

MailBuilder builder = replyBuilder.ReplyToAll(
    new MailBox(&quot;bob@example.org&quot;, &quot;Bob&quot;));

// You can add attachments to your reply
//builder.AddAttachment(&quot;report.csv&quot;);

IMail reply = builder.Create();

using (Smtp smtp = new Smtp())
{
    smtp.Connect(&quot;smtp.example.com&quot;); // or ConnectSSL
    smtp.UseBestLogin(&quot;user&quot;, &quot;password&quot;);
    smtp.SendMessage(reply);
    smtp.Close();
}

static IMail GetFirstMessage()
{
    IMail email;
    using (Imap imap = new Imap())
    {
        imap.Connect(&quot;imap.example.com&quot;); // or ConnectSSL if you want to use SSL
        imap.UseBestLogin(&quot;user&quot;, &quot;password&quot;);
        List&lt;long&gt; uids = imap.GetAll();
        if (uids.Count == 0)
            throw new Exception(&quot;There are no messages&quot;);
        string eml = imap.GetMessageByUID(uids[0]);
        email = new MailBuilder().CreateFromEml(eml);
        imap.Close();
    }
    return email;
}
</pre>
<pre class="brush: vb;">
' VB.NET

Dim original As IMail = GetFirstMessage()

Dim replyBuilder As ReplyBuilder = original.Reply()

' You can specify your own custom template:
replyBuilder.HtmlReplyTemplate = _
    &quot;[Html]&quot; + _
    &quot;&lt;br /&gt;&lt;br /&gt;&quot; + _
    &quot;On [Original.Date] [Original.Sender.Name] wrote:&quot; + _
    &quot;&lt;blockquote &quot; + _
        &quot;style='margin-left: 1em; &quot; + _
        &quot;padding-left: 1em; &quot; + _
        &quot;border-left: 1px #ccc solid;'&gt;&quot; + _
    &quot;[QuoteHtml]&quot; + _
    &quot;&lt;/blockquote&gt;&quot;

replyBuilder.Html = _
    &quot;Alice, &lt;br/&gt;&lt;br/&gt;thanks for your email.&quot;

Dim builder As MailBuilder = replyBuilder.ReplyToAll( _
    New MailBox(&quot;bob@example.org&quot;, &quot;Bob&quot;))

' You can add attachments to your reply
'builder.AddAttachment(&quot;report.csv&quot;)

Dim reply As IMail = builder.Create()

Using smtp As New Smtp()
	smtp.Connect(&quot;smtp.example.com&quot;) ' or ConnectSSL
	smtp.UseBestLogin(&quot;user&quot;, &quot;password&quot;)
	smtp.SendMessage(reply)
	smtp.Close()
End Using

Private Shared Function GetFirstMessage() As IMail
	Dim email As IMail
	Using imap As New Imap()
		imap.Connect(&quot;imap.example.com&quot;)
		' or ConnectSSL if you want to use SSL
		imap.UseBestLogin(&quot;user&quot;, &quot;password&quot;)
		Dim uids As List(Of Long) = imap.GetAll()
		If uids.Count = 0 Then
			Throw New Exception(&quot;There are no messages&quot;)
		End If
		Dim eml As String = imap.GetMessageByUID(uids(0))
		email = New MailBuilder().CreateFromEml(eml)
		imap.Close()
	End Using
	Return email
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/reply-to-email/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Get supported authentication methods (IMAP, POP3, SMTP)</title>
		<link>http://www.limilabs.com/blog/get-supported-authentication-methods-imap-pop3-smtp?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=get-supported-authentication-methods-imap-pop3-smtp</link>
		<comments>http://www.limilabs.com/blog/get-supported-authentication-methods-imap-pop3-smtp#comments</comments>
		<pubDate>Thu, 06 Oct 2011 15:13:53 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2000</guid>
		<description><![CDATA[You can use SupportedAuthenticationMethods to retrieve all authentication methods supported by the server: // C# using (Imap client = new Imap()) { client.ConnectSSL(&#34;imap.example.org&#34;); client.UseBestLogin(&#34;user&#34;, &#34;password&#34;); Console.WriteLine(&#34;Supported methods:&#34;); foreach (var method in client.SupportedAuthenticationMethods()) { Console.WriteLine(method.Name); } Console.WriteLine(&#34;Supports CramMD5:&#34;); bool supportsCramMD5 = client.SupportedAuthenticationMethods() .Contains(ImapAuthenticationMethod.CramMD5); Console.WriteLine(supportsCramMD5); client.Close(); } ' VB.NET Using client As New Imap() client.ConnectSSL(&#34;imap.example.org&#34;) client.UseBestLogin(&#34;user&#34;, &#34;password&#34;) [...]]]></description>
			<content:encoded><![CDATA[<p>You can use <em>SupportedAuthenticationMethods</em> to retrieve all authentication methods supported by the server:</p>
<pre class="brush: csharp;">
// C#

using (Imap client = new Imap())
{
    client.ConnectSSL(&quot;imap.example.org&quot;);
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;);

    Console.WriteLine(&quot;Supported methods:&quot;);

    foreach (var method in client.SupportedAuthenticationMethods())
    {
        Console.WriteLine(method.Name);
    }

    Console.WriteLine(&quot;Supports CramMD5:&quot;);

    bool supportsCramMD5 = client.SupportedAuthenticationMethods()
        .Contains(ImapAuthenticationMethod.CramMD5);

    Console.WriteLine(supportsCramMD5);

    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET

Using client As New Imap()
    client.ConnectSSL(&quot;imap.example.org&quot;)
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)

    Console.WriteLine(&quot;Supported methods:&quot;)

    For Each method As ImapAuthenticationMethod In client.SupportedAuthenticationMethods()
	    Console.WriteLine(method.Name)
    Next

    Console.WriteLine(&quot;Supports CramMD5:&quot;)

    Dim supportsCramMD5 As Boolean = client.SupportedAuthenticationMethods() _
        .Contains(ImapAuthenticationMethod.CramMD5)

    Console.WriteLine(supportsCramMD5)

    client.Close()
End Using
</pre>
<p>For example Gmail produces following output:</p>
<pre class="brush: plain;">
Supported method s:
IMAP4rev1
UNSELECT
IDLE
NAMESPACE
QUOTA
ID
XLIST
CHILDREN
X-GM-EXT-1
UIDPLUS
COMPRESS

Supports CramMD5:
False
</pre>
<p>We take great care for the API to look similar for all protocols (IMAP, POP3, SMTP).</p>
<p>Here&#8217;s the<strong> sample for POP3</strong>:</p>
<pre class="brush: csharp;">
// C#

using (Pop3 client = new Pop3())
{
    client.ConnectSSL(&quot;pop3.example.org&quot;);
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;);

    Console.WriteLine(&quot;Supported methods:&quot;);

    foreach (var method in client.SupportedAuthenticationMethods())
    {
        Console.WriteLine(method.Name);
    }

    Console.WriteLine(&quot;Supports CramMD5:&quot;);

    bool supportsCramMD5 = client.SupportedAuthenticationMethods()
        .Contains(Pop3AuthenticationMethod.CramMD5);

    Console.WriteLine(supportsCramMD5);

    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET

Using client As New Pop3()
    client.ConnectSSL(&quot;pop3.example.org&quot;)
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)

    Console.WriteLine(&quot;Supported methods:&quot;)

    For Each method As Pop3AuthenticationMethod In client.SupportedAuthenticationMethods()
	    Console.WriteLine(method.Name)
    Next

    Console.WriteLine(&quot;Supports CramMD5:&quot;)

    Dim supportsCramMD5 As Boolean = client.SupportedAuthenticationMethods() _
        .Contains(Pop3AuthenticationMethod.CramMD5)

    Console.WriteLine(supportsCramMD5)

    client.Close()
End Using
</pre>
<p>Here&#8217;s the<strong> sample for SMTP</strong>:</p>
<pre class="brush: csharp;">
// C#

using (Smtpclient = new Smtp())
{
    client.Connect(&quot;smtp.example.org&quot;);
    client.UseBestLogin(&quot;smtp&quot;, &quot;password&quot;);

    Console.WriteLine(&quot;Supported methods:&quot;);

    foreach (var method in client.SupportedAuthenticationMethods())
    {
        Console.WriteLine(method.Name);
    }

    Console.WriteLine(&quot;Supports CramMD5:&quot;);

    bool supportsCramMD5 = client.SupportedAuthenticationMethods()
        .Contains(SmtpAuthenticationMethod.CramMD5);

    Console.WriteLine(supportsCramMD5);

    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET

Using client As New Smtp()
    client.Connect(&quot;smtp.example.org&quot;)
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)

    Console.WriteLine(&quot;Supported methods:&quot;)

    For Each method As SmtpAuthenticationMethod In client.SupportedAuthenticationMethods()
	    Console.WriteLine(method.Name)
    Next

    Console.WriteLine(&quot;Supports CramMD5:&quot;)

    Dim supportsCramMD5 As Boolean = client.SupportedAuthenticationMethods() _
        .Contains(SmtpAuthenticationMethod.CramMD5)

    Console.WriteLine(supportsCramMD5)

    client.Close()
End Using
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/get-supported-authentication-methods-imap-pop3-smtp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get supported server extensions (IMAP, POP3, SMTP)</title>
		<link>http://www.limilabs.com/blog/get-supported-server-extensions-imap-pop3-smtp?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=get-supported-server-extensions-imap-pop3-smtp</link>
		<comments>http://www.limilabs.com/blog/get-supported-server-extensions-imap-pop3-smtp#comments</comments>
		<pubDate>Thu, 06 Oct 2011 12:46:12 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=1992</guid>
		<description><![CDATA[Not every server supports same extensions. There are 3 classes that represent server extensions for each email protocol: ImapExtension, Pop3Extension and SmtpExtension. Those classes contain static properties with well-know extensions like: ImapExtension.Idle or ImapExtension.Sort or Pop3Extension.STLS etc. You can use SupportedExtensions method to retrieve all protocol extensions supported by the server. Get supported IMAP server [...]]]></description>
			<content:encoded><![CDATA[<p>Not every server supports same extensions. There are 3 classes that represent server extensions for each email protocol: <em>ImapExtension</em>, <em>Pop3Extension </em>and <em>SmtpExtension</em>. Those classes contain static properties with well-know extensions like: <em>ImapExtension.Idle</em> or <em>ImapExtension.Sort</em> or <em>Pop3Extension.STLS</em> etc.</p>
<p>You can use <em>SupportedExtensions</em> method to retrieve all protocol extensions supported by the server.</p>
<h2>Get supported IMAP server extensions</h2>
<pre class="brush: csharp;">
// C#

using (Imap client = new Imap())
{
    client.ConnectSSL(&quot;imap.example.org&quot;);
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;);

    Console.WriteLine(&quot;Supported extensions:&quot;);

    foreach (ImapExtension extension in client.SupportedExtensions())
    {
        Console.WriteLine(extension.Name);
    }

    Console.WriteLine(&quot;Supports IDLE:&quot;);

    bool supportsIdle = client.SupportedExtensions()
        .Contains(ImapExtension.Idle);

    Console.WriteLine(supportsIdle);

    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET

Using client As New Imap()
    client.ConnectSSL(&quot;imap.example.org&quot;)
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)

    Console.WriteLine(&quot;Supported extensions:&quot;)

    For Each extension As ImapExtension In client.SupportedExtensions()
	    Console.WriteLine(extension.Name)
    Next

    Console.WriteLine(&quot;Supports IDLE:&quot;)

    Dim supportsIdle As Boolean = client.SupportedExtensions() _
        .Contains(ImapExtension.Idle)

    Console.WriteLine(supportsIdle)

    client.Close()
End Using
</pre>
<p>For example Gmail produces following output:</p>
<pre class="brush: plain;">
Supported extensions:
IMAP4rev1
UNSELECT
IDLE
NAMESPACE
QUOTA
ID
XLIST
CHILDREN
X-GM-EXT-1
UIDPLUS
COMPRESS

Supports IDLE:
True
</pre>
<p><img src="http://www.limilabs.com/blog/wp-content/uploads/2010/04/capabilities.png" alt="" title="capabilities" width="288" height="154" class="aligncenter size-full wp-image-833" /></p>
<p>We take great care for the API to look similar for all protocols (IMAP, POP3, SMTP).</p>
<h2>Get supported POP3 server extensions</h2>
<pre class="brush: csharp;">
// C#

using (Pop3 client = new Pop3())
{
    client.ConnectSSL(&quot;pop3.example.org&quot;);
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;);

    Console.WriteLine(&quot;Supported extensions:&quot;);

    foreach (Pop3Extension extension in client.SupportedExtensions())
    {
        Console.WriteLine(extension.Name);
    }

    Console.WriteLine(&quot;Supports TOP:&quot;);

    bool supportsTop= client.SupportedExtensions()
        .Contains(Pop3Extension.Top);

    Console.WriteLine(supportsTop);

    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET

Using client As New Pop3()
    client.ConnectSSL(&quot;pop3.example.org&quot;)
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)

    Console.WriteLine(&quot;Supported extensions:&quot;)

    For Each extension As Pop3Extension In client.SupportedExtensions()
	    Console.WriteLine(extension.Name)
    Next

    Console.WriteLine(&quot;Supports TOP:&quot;)

    Dim supportsTop As Boolean = client.SupportedExtensions() _
        .Contains(Pop3Extension.Top)

    Console.WriteLine(supportsTop)

    client.Close()
End Using
</pre>
<h2>Get supported SMTP server extensions</h2>
<pre class="brush: csharp;">
// C#

using (Smtpclient = new Smtp())
{
    client.Connect(&quot;smtp.example.org&quot;);
    client.UseBestLogin(&quot;smtp&quot;, &quot;password&quot;);

    Console.WriteLine(&quot;Supported extensions:&quot;);

    foreach (SmtpExtension  extension in client.SupportedExtensions())
    {
        Console.WriteLine(extension.Name);
    }

    Console.WriteLine(&quot;Supports STARTTLS:&quot;);

    bool supportsStartTLS = client.SupportedExtensions()
        .Contains(SmtpExtension.StartTLS);

    Console.WriteLine(supportsStartTLS);

    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET

Using client As New Smtp()
    client.Connect(&quot;smtp.example.org&quot;)
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)

    Console.WriteLine(&quot;Supported extensions:&quot;)

    For Each extension As SmtpExtension In client.SupportedExtensions()
	    Console.WriteLine(extension.Name)
    Next

    Console.WriteLine(&quot;Supports STARTTLS:&quot;)

    Dim supportsStartTLS As Boolean = client.SupportedExtensions() _
        .Contains(SmtpExtension.StartTLS)

    Console.WriteLine(supportsStartTLS)

    client.Close()
End Using
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/get-supported-server-extensions-imap-pop3-smtp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send encrypted email using S/MIME</title>
		<link>http://www.limilabs.com/blog/send-encrypted-email-using-smime?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=send-encrypted-email-using-smime</link>
		<comments>http://www.limilabs.com/blog/send-encrypted-email-using-smime#comments</comments>
		<pubDate>Wed, 26 Jan 2011 13:00:22 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[SMIME]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=1693</guid>
		<description><![CDATA[Sending encrypted and signed S/MIME messages has never been easier: // C# version IMail email = Mail .Html(&#34;&#60;html&#62;&#60;body&#62;Encrypted and signed&#60;/body&#62;&#60;/html&#62;&#34;) .Subject(&#34;Encrypted and signed&#34;) .From(new MailBox(&#34;email@in-the-certificate.com&#34;, &#34;Alice&#34;)) .To(new MailBox(&#34;bob@mail.com&#34;, &#34;Bob&#34;)) .AddAttachment(@&#34;c:\report_2010.pdf&#34;) .SignWith(new X509Certificate2(&#34;SignCertificate.pfx&#34;, &#34;&#34;)) .EncryptWith(new X509Certificate2(&#34;EncryptCertificate.pfx&#34;, &#34;&#34;)) .EncryptWith(new X509Certificate2(&#34;BobsCertificate.pfx&#34;, &#34;&#34;)) .Create(); using (Smtp client = new Smtp()) { client.Connect(&#34;smtp.example.com&#34;); // or ConnectSSL client.UseBestLogin(&#34;user&#34;, &#34;password&#34;); client.SendMessage(email); client.Close(); [...]]]></description>
			<content:encoded><![CDATA[<p>Sending <strong>encrypted and signed S/MIME</strong> messages has never been easier:</p>
<pre class="brush: csharp;">
// C# version

IMail email = Mail
    .Html(&quot;&lt;html&gt;&lt;body&gt;Encrypted and signed&lt;/body&gt;&lt;/html&gt;&quot;)
    .Subject(&quot;Encrypted and signed&quot;)
    .From(new MailBox(&quot;email@in-the-certificate.com&quot;, &quot;Alice&quot;))
    .To(new MailBox(&quot;bob@mail.com&quot;, &quot;Bob&quot;))
    .AddAttachment(@&quot;c:\report_2010.pdf&quot;)
    .SignWith(new X509Certificate2(&quot;SignCertificate.pfx&quot;, &quot;&quot;))
    .EncryptWith(new X509Certificate2(&quot;EncryptCertificate.pfx&quot;, &quot;&quot;))
    .EncryptWith(new X509Certificate2(&quot;BobsCertificate.pfx&quot;, &quot;&quot;))
    .Create();

using (Smtp client = new Smtp())
{
    client.Connect(&quot;smtp.example.com&quot;); // or ConnectSSL
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;);
    client.SendMessage(email);
    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET version

Dim email As IMail = Mail _
	.Html(&quot;&lt;html&gt;&lt;body&gt;Encrypted and signed&lt;/body&gt;&lt;/html&gt;&quot;) _
	.Subject(&quot;Encrypted and signed&quot;) _
	.From(New MailBox(&quot;email@in-the-certificate.com&quot;, &quot;Alice&quot;)) _
	.To(New MailBox(&quot;bob@mail.com&quot;, &quot;Bob&quot;)) _
	.AddAttachment(&quot;c:\report_2010.pdf&quot;) _
	.SignWith(New X509Certificate2(&quot;SignCertificate.pfx&quot;, &quot;&quot;)) _
	.EncryptWith(New X509Certificate2(&quot;EncryptCertificate.pfx&quot;, &quot;&quot;)) _
	.EncryptWith(New X509Certificate2(&quot;BobsCertificate.pfx&quot;, &quot;&quot;)) _
	.Create()

Using client As New Smtp()
	client.Connect(&quot;smtp.example.com&quot;) ' or ConnectSSL
	client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)
	client.SendMessage(email)
	client.Close()
End Using
</pre>
<p>Remember to <strong>encrypt your emails with both sender&#8217;s and receiver&#8217;s certificates</strong>.<br />
This way both parties are able to decrypt such emails.</p>
<p>Common errors you may encounter:</p>
<ul>
<li>Please use the <strong>PersistKeySet </strong> flag when loading from file (new X509Certificate2(_certificatePath, &#8220;&#8221;, X509KeyStorageFlags.PersistKeySet);) and adding to store
</li>
<li><strong>&#8220;Bad key&#8221;</strong> exception message means that certificate was not for key exchange &#8211; makecert needs an extra parameter to create certificate that can be used for symmetric algorithm key exchange: -sky exchange.
</li>
<li><strong>&#8220;the enveloped data-message does not contain the specified recipient&#8221;</strong> means that certificate with the private key is not deployed into the current account/local machine personal store, or not in the certificates list
</li>
</ul>
<p>You can use following commands in VisualStudio Command Prompt to create test certificate:</p>
<p><code>makecert.exe -pe -r -sv Test_Keys.pvk -n "CN=John Doe,E=email@in-the-certificate.com" -sky exchange Test.cer</code></p>
<p><code>pvk2pfx.exe -pvk Test_Keys.pvk -spc Test.cer -pfx Test.pfx</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/send-encrypted-email-using-smime/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I have problems issuing IMAP, POP3 or SMTP command</title>
		<link>http://www.limilabs.com/blog/i-have-problems-issuing-imap-pop3-smtp-command?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=i-have-problems-issuing-imap-pop3-smtp-command</link>
		<comments>http://www.limilabs.com/blog/i-have-problems-issuing-imap-pop3-smtp-command#comments</comments>
		<pubDate>Wed, 05 Jan 2011 14:51:44 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=1734</guid>
		<description><![CDATA[Mail.dll is a rock solid product, however most email servers don&#8217;t follow rigorously the RFC specifications. In the following few steps we&#8217;ll help you gather the information we need to make Mail.dll clients better. If you have problems parsing a message please go here. 1. First please check if you have the latest version installed. [...]]]></description>
			<content:encoded><![CDATA[<p>Mail.dll is a rock solid product, however most email servers don&#8217;t follow rigorously the RFC specifications. In the following few steps we&#8217;ll help you gather the information we need to make Mail.dll clients better.</p>
<p>If you <a href="http://www.limilabs.com/blog/i-have-problems-parsing-the-message">have problems parsing a message please go here</a>.</p>
<p>1.<br />
First please check if you have the latest version installed.</p>
<p>2.<br />
Please <strong>identify the command/set of commands</strong> that cause problems.</p>
<p>3.<br />
<strong>Enable logging</strong> for Mail.dll clients:</p>
<pre class="brush: csharp;">
// C# version:

Log.Enabled = true;
</pre>
<pre class="brush: vb;">
' VB.NET version:

Log.Enabled = True
</pre>
<p>You can observe standard Visual Studio trace output or add a custom listener to <em>Trace.Listeners</em> collection.</p>
<p><img src="http://www.limilabs.com/blog/wp-content/uploads/2010/11/Mail_Log.png" alt="" title="Mail.dll Log" width="602" height="582" class="aligncenter size-full wp-image-1479" /></p>
<p>You can also enable logging using App.config file:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;configuration&gt;
    &lt;system.diagnostics&gt;
      &lt;switches&gt;
        &lt;add name=&quot;Mail.dll&quot; value=&quot;True&quot; /&gt;
      &lt;/switches&gt;
    &lt;/system.diagnostics&gt;
&lt;/configuration&gt;
</pre>
<p>You can create your custom TraceListener that writes log to file:</p>
<pre class="brush: csharp;">
// C# version:

internal class MyListener : TextWriterTraceListener
{
    public MyListener(string fileName)
        : base(fileName)
    {
    }

    public override void Write(string message, string category)
    {
        if (category == &quot;Mail.dll&quot;)
            base.Write(message, category);
    }

    public override void WriteLine(string message, string category)
    {
        if (category == &quot;Mail.dll&quot;)
            base.WriteLine(message, category);
    }
}
</pre>
<pre class="brush: vb;">
' VB.NET version

Friend Class MyListener
	Inherits TextWriterTraceListener
	Public Sub New(fileName As String)
		MyBase.New(fileName)
	End Sub

	Public Overrides Sub Write(message As String, category As String)
		If category = &quot;Mail.dll&quot; Then
			MyBase.Write(message, category)
		End If
	End Sub

	Public Overrides Sub WriteLine(message As String, category As String)
		If category = &quot;Mail.dll&quot; Then
			MyBase.WriteLine(message, category)
		End If
	End Sub
End Class
</pre>
<p>&#8230;then add it to Listeners collection:</p>
<pre class="brush: csharp;">
// C# version:

Log.Enabled = true;
Trace.Listeners.Add(new MyListener(@&quot;c:mail_log.txt&quot;));
Trace.AutoFlush = true;
</pre>
<pre class="brush: vb;">
' VB.NET version:

Log.Enabled = True
Trace.Listeners.Add(New MyListener(&quot;c:mail_log.txt&quot;))
Trace.AutoFlush = True
</pre>
<p>4.<br />
Perform the operations that cause the problems, and save the log to file.<br />
You can remove username and password, but please do not modify the file extensively. If you do, it may be impossible to reproduce the issue.<br />
In particular do not change new line format nor encoding.</p>
<p>5.<br />
Please answer following questions:</p>
<ul>
<li>What <strong>exception </strong>are you getting?</li>
<li>What is the exception <strong>stack trace</strong>?</li>
<li>What is the exception <strong>message</strong>?</li>
<li>What result you expect?</li>
<li>What result are you getting?</li>
<li>Which .NET Framework version are you using?</li>
<li>Is it console, windows forms, windows service or web application?</li>
<li>If it is possible please attach the source code you are using</li>
</ul>
<p>6.<br />
Finally please <strong>zip the log file and send it as attachment</strong>, along with all the answers to <a class="email" title="Write to us - we're enthusiastic about support"></a>.</p>
<p><strong>Thanks!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/i-have-problems-issuing-imap-pop3-smtp-command/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I have problems parsing the message</title>
		<link>http://www.limilabs.com/blog/i-have-problems-parsing-the-message?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=i-have-problems-parsing-the-message</link>
		<comments>http://www.limilabs.com/blog/i-have-problems-parsing-the-message#comments</comments>
		<pubDate>Tue, 04 Jan 2011 14:11:16 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[eml]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=1728</guid>
		<description><![CDATA[Mail.dll is a rock solid product, however most of the emails don&#8217;t follow rigorously the RFC specifications. In the following few steps we&#8217;ll help you gather the information we need to make Mail.dll parser better. If you have problems issuing IMAP, POP3, or SMTP command please go here. 1. First please check if you have [...]]]></description>
			<content:encoded><![CDATA[<p>Mail.dll is a rock solid product, however most of the emails don&#8217;t follow rigorously the RFC specifications. In the following few steps we&#8217;ll help you gather the information we need to make Mail.dll parser better.</p>
<p>If you <a href="http://www.limilabs.com/blog/i-have-problems-issuing-imap-pop3-smtp-command">have problems issuing IMAP, POP3, or SMTP command please go here</a>.</p>
<p>1.<br />
First please check if you have the latest version installed.</p>
<p>2.<br />
Please <strong>identify unique id (UID)</strong> of the message you are having problems with.</p>
<p>3.<br />
Next step is to <strong>download entire message and save it as raw eml</strong> file.<br />
Note that you should not parse the email, so there is no need to use <em>MailBuilder</em> and <em>IMail</em> classes.</p>
<p><strong>IMAP version:</strong></p>
<pre class="brush: csharp;">
// C# code

long uid = 12345;

using (Imap imap = new Imap())
{
    imap.Connect(&quot;server&quot;);
    // imap.ConnectSSL(&quot;server&quot;); // if you need SSL connection.
    imap.UseBestLogin(&quot;user&quot;, &quot;password&quot;);
    imap.SelectInbox();

    string eml = imap.GetMessageByUID(uid);
    string fileName = string.Format(@&quot;c:\email_{0}.eml&quot;, uid);
    File.WriteAllText(fileName, eml, Encoding.UTF8);

    imap.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET code

Dim uid As Long = 12345

Using imap As New Imap()
	imap.Connect(&quot;server&quot;)
	' imap.ConnectSSL(&quot;server&quot;) ' if you need SSL connection.
	imap.UseBestLogin(&quot;user&quot;, &quot;password&quot;)
	imap.SelectInbox()

	Dim eml As String = imap.GetMessageByUID(uid)
	Dim fileName As String = String.Format(&quot;c:\email_{0}.eml&quot;, uid)
	File.WriteAllText(fileName, eml, Encoding.UTF8)

	imap.Close()
End Using
</pre>
<p><strong>POP3 version:</strong></p>
<pre class="brush: csharp;">
// C# code

string uid = &quot;12345&quot;;

using (Pop3 pop3 = new Pop3())
{
    pop3.Connect(&quot;server&quot;);
    // pop3.ConnectSSL(&quot;server&quot;); // if you need SSL connection.
    pop3.Login(&quot;user&quot;, &quot;password&quot;);

    string eml = pop3.GetMessageByUID(uid));
    string fileName = string.Format(@&quot;c:\email_{0}.eml&quot;, uid);
    File.WriteAllText(fileName, eml, Encoding.UTF8);

    pop3.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET code

Dim uid As String = &quot;12345&quot;

Using pop3 As New Pop3()
	pop3.Connect(&quot;server&quot;)
	' pop3.ConnectSSL(&quot;server&quot;); ' if you need SSL connection.
	pop3.Login(&quot;user&quot;, &quot;password&quot;)

	Dim eml As String = pop3.GetMessageByUID(uid)
	Dim fileName As String = String.Format(&quot;c:\email_{0}.eml&quot;, uid)
	File.WriteAllText(fileName, eml, Encoding.UTF8)

	pop3.Close()
End Using
</pre>
<p>4.<br />
Please answer following questions:</p>
<ul>
<li>What <strong>exception </strong>are you getting?</li>
<li>What is the exception<strong> stack trace</strong>?</li>
<li>What is the exception <strong>message</strong>?</li>
<li>What result you expect?</li>
<li>What result are you getting?</li>
<li>Which .NET Framework version are you using?</li>
<li>Is it console, windows forms, windows service or web application?</li>
<li>If it is possible please attach the source code you are using</li>
</ul>
<p>5.<br />
Finally please <strong>zip the eml file and send it as attachment</strong>, along with all the answers to<br />
<a class="email" title="Write to us - we're enthusiastic about support"></a>.</p>
<p><strong>Thanks!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/i-have-problems-parsing-the-message/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Send iCalendar recurring meeting requests</title>
		<link>http://www.limilabs.com/blog/send-icalendar-recurring-meeting-requests?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=send-icalendar-recurring-meeting-requests</link>
		<comments>http://www.limilabs.com/blog/send-icalendar-recurring-meeting-requests#comments</comments>
		<pubDate>Fri, 19 Nov 2010 16:57:16 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[iCalendar]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=1614</guid>
		<description><![CDATA[First add all necessary namespaces: // C# version using System; using Limilabs.Mail; using Limilabs.Mail.Appointments; using Limilabs.Mail.Headers; using Fluent = Limilabs.Mail.Fluent; using Limilabs.Client.SMTP; ' VB.NET version Imports System; Imports Limilabs.Mail; Imports Limilabs.Mail.Appointments; Imports Limilabs.Mail.Headers; Imports Fluent = Limilabs.Mail.Fluent; Imports Limilabs.Client.SMTP; Now, we&#8217;ll create an appointment, specify it&#8217;s recurring options and send it: // C# version Appointment [...]]]></description>
			<content:encoded><![CDATA[<p>First add all necessary namespaces:</p>
<pre class="brush: csharp;">
// C# version

using System;
using Limilabs.Mail;
using Limilabs.Mail.Appointments;
using Limilabs.Mail.Headers;
using Fluent = Limilabs.Mail.Fluent;
using Limilabs.Client.SMTP;
</pre>
<pre class="brush: vb;">
' VB.NET version

Imports System;
Imports Limilabs.Mail;
Imports Limilabs.Mail.Appointments;
Imports Limilabs.Mail.Headers;
Imports Fluent = Limilabs.Mail.Fluent;
Imports Limilabs.Client.SMTP;
</pre>
<p>Now, we&#8217;ll create an appointment, specify it&#8217;s recurring options and send it:</p>
<pre class="brush: csharp;">
// C# version

Appointment appointment = new Appointment();
Event newEvent = appointment.AddEvent();
newEvent.SetOrganizer(new Person(&quot;Alice&quot;, &quot;alice@example.org&quot;));
newEvent.AddParticipant(new Participant(&quot;Bob&quot;, &quot;bob@gmail.com&quot;));
newEvent.Description = &quot;We need to talk about the daily report&quot;;
newEvent.Summary = &quot;Daily report meeting&quot;;
newEvent.Start = new DateTime(2010, 11, 29, 16, 0, 0);
newEvent.End = new DateTime(2010, 11, 29, 17, 0, 0);
newEvent.Priority = 5;
newEvent.Class = EventClass.Public;

RecurringRule rule = newEvent.AddRecurringRule();
rule.Interval = 1;
rule.Until = new DateTime(2011, 12, 1); // -or- rule.Count = 10;

// Every week on  Mon, Tue, Wed, Thu Fri:
rule.Frequency = Frequency.Weekly;
rule.ByDay.AddRange(new[] {
    Weekday.Monday,
    Weekday.Tuesday,
    Weekday.Wednesday,
    Weekday.Thursday,
    Weekday.Friday });

Alarm alarm = newEvent.AddAlarm();
alarm.Description = &quot;Reminder&quot;;
alarm.BeforeStart(TimeSpan.FromMinutes(5));

IMail email = Fluent.Mail.Text(&quot;Daily report meeting at 4PM&quot;)
    .Subject(&quot;Daily report meeting&quot;)
    .From(new MailBox(&quot;alice@example.org&quot;, &quot;Alice&quot;))
    .To(new MailBox(&quot;bob@example.org&quot;, &quot;Bob&quot;))
    .AddAppointment(appointment)
    .Create();

using (Smtp client = new Smtp())
{
    client.ConnectSSL(&quot;smtp.example.org&quot;);
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;);
    client.SendMessage(email);
    client.Close();
}
</pre>
<pre class="brush: vb;">
' VB.NET version

Dim appointment As New Appointment()
Dim newEvent As [Event] = appointment.AddEvent()
newEvent.SetOrganizer(New Person(&quot;Alice&quot;, &quot;alice@example.org&quot;))
newEvent.AddParticipant(New Participant(&quot;Bob&quot;, &quot;bob@gmail.com&quot;))
newEvent.Description = &quot;We need to talk about the daily report&quot;
newEvent.Summary = &quot;Daily report meeting&quot;
newEvent.Start = New DateTime(2010, 11, 29, 16, 0, 0)
newEvent.[End] = New DateTime(2010, 11, 29, 17, 0, 0)
newEvent.Priority = 5
newEvent.[Class] = EventClass.[Public]

Dim rule As RecurringRule = newEvent.AddRecurringRule()
rule.Interval = 1
rule.Until = New DateTime(2011, 12, 1)
' -or- rule.Count = 10;
' Every week on  Mon, Tue, Wed, Thu Fri:
rule.Frequency = Frequency.Weekly
rule.ByDay.AddRange(New Weekday() {Weekday.Monday _
                                   , Weekday.Tuesday _
                                   , Weekday.Wednesday _
                                   , Weekday.Thursday _
                                   , Weekday.Friday})

Dim alarm As Alarm = newEvent.AddAlarm()
alarm.Description = &quot;Reminder&quot;
alarm.BeforeStart(TimeSpan.FromMinutes(5))

Dim email As IMail = Fluent.Mail.Text(&quot;Daily report meeting at 4PM&quot;) _
    .Subject(&quot;Daily report meeting&quot;) _
    .From(New MailBox(&quot;alice@example.org&quot;, &quot;Alice&quot;)) _
    .[To](New MailBox(&quot;bob@example.org&quot;, &quot;Bob&quot;)) _
    .AddAppointment(appointment).Create()

Using client As New Smtp()
    client.ConnectSSL(&quot;smtp.example.org&quot;)
    client.UseBestLogin(&quot;user&quot;, &quot;password&quot;)
    client.SendMessage(email)
    client.Close()
End Using
</pre>
<p>This is how it looks like in Gmail:</p>
<p><img src="http://www.limilabs.com/blog/wp-content/uploads/2010/11/RecurringAppointment1.jpg" alt="Recurring appointment" title="Recurring appointment" width="600" height="370" class="aligncenter size-full wp-image-1619" /></p>
<p><img src="http://www.limilabs.com/blog/wp-content/uploads/2010/11/RecurringAppointment1.jpg" alt="Recurring appointment" title="Recurring appointment" width="600" height="370" class="aligncenter size-full wp-image-1619" /></p>
<p>Here are the few samples of how you can set the frequency:</p>
<p>Daily:</p>
<pre class="brush: csharp;">
// C# version

rule.Frequency = Frequency.Daily;
</pre>
<pre class="brush: vb;">
' VB.NET version

rule.Frequency = Frequency.Daily
</pre>
<p>Every month on last monday:</p>
<pre class="brush: csharp;">
// C# version

rule.Frequency = Frequency.Monthly;
rule.ByDay.Add(Weekday.LastMonday);
</pre>
<pre class="brush: vb;">
' VB.NET version

rule.Frequency = Frequency.Monthly
rule.ByDay.Add(Weekday.LastMonday)
</pre>
<p>Every month on second but last monday:</p>
<pre class="brush: csharp;">
// C# version

rule.Frequency = Frequency.Monthly;
rule.ByDay.Add(new Weekday(-2, Weekday.Monday));
</pre>
<pre class="brush: vb;">
' VB.NET version

rule.Frequency = Frequency.Monthly
rule.ByDay.Add(New Weekday(-2, Weekday.Monday))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/send-icalendar-recurring-meeting-requests/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A connection attempt failed</title>
		<link>http://www.limilabs.com/blog/connection-attempt-failed?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=connection-attempt-failed</link>
		<comments>http://www.limilabs.com/blog/connection-attempt-failed#comments</comments>
		<pubDate>Mon, 15 Nov 2010 13:26:30 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=1587</guid>
		<description><![CDATA[If you are getting following or similar exception: &#8220;A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond&#8221; or &#8220;No connection could be made because the target machine actively refused it.&#8221; most likely you provided incorrect server, [...]]]></description>
			<content:encoded><![CDATA[<p>If you are getting following or similar exception:<br />
<strong>&#8220;A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond&#8221;</strong> or <strong>&#8220;No connection could be made because the target machine actively refused it.&#8221;</strong> most likely you provided <strong>incorrect server, port, and SSL usage</strong> configuration to <em>Connect</em>, or <em>ConnectSSL </em>methods.</p>
<p>Most email providers (like Gmail, Hotmail, Yahoo and others) use default ports. <em>Connect</em>() and <em>ConnectSSL</em>() and fluent interface use those ports when not specified otherwise.</p>
<p>Default ports for email protocols are:</p>
<table>
<tr>
<th>Protocol</th>
<th>Without SSL</th>
<th>With SSL</th>
</tr>
<tr>
<td><strong>IMAP</strong></td>
<td>143</td>
<td>993</td>
</tr>
<tr>
<td><strong>POP3</strong></td>
<td>110</td>
<td>995</td>
</tr>
<tr>
<td><strong>SMTP</strong></td>
<td>25</td>
<td>465</td>
</tr>
</table>
<p><strong>Please ask your email server administrator for server, port, and SSL usage</strong>,<br />
if those are not standard there is no way you can guess them.</p>
<p>Please also make sure that:</p>
<ul>
<li>you are using correct client class with protocol and port you plan to use (<em>Pop3 </em>class with POP3 protocol, <em>Imap </em>class with IMAP, and <em>Smtp </em>class with SMTP protocol)</li>
<li>you are using ConnectSSL when you require SSL, and Connect when you don&#8217;t</li>
<li><strong>firewall and antivirus software are disabled</strong> or configured correctly</li>
<li>the protocol you are trying to use is enabled on the server. Exchange or Gmail can have some protocols disabled by default</li>
</ul>
<p>Following articles can help you with that:</p>
<ul>
<li><a href="http://www.limilabs.com/blog/enable-pop3-in-gmail">How to enable POP3 in Gmail</a></li>
<li><a href="http://www.limilabs.com/blog/enable-imap-in-gmail">How to enable IMAP in  Gmail</a></li>
<li><a href="http://technet.microsoft.com/en-us/library/bb124489.aspx">How to enable IMAP for Exchange</a></li>
</ul>
<p>Establishing connection using default port is simple:</p>
<pre class="brush: csharp;">
// C#

client.Connect(&quot;mail.example.com&quot;);
</pre>
<pre class="brush: vb;">
' VB.NET

client.Connect(&quot;mail.example.com&quot;)
</pre>
<p>or if <strong>SSL</strong> is enabled:</p>
<pre class="brush: csharp;">
// C#

client.ConnectSSL(&quot;mail.example.com&quot;);
</pre>
<pre class="brush: vb;">
' VB.NET

client.ConnectSSL(&quot;mail.example.com&quot;)
</pre>
<p>If you need to <strong>specify different port</strong> just <strong>use overloaded</strong> version of Connect method:</p>
<pre class="brush: csharp;">
// C#

client.Connect(&quot;mail.example.com&quot;, 999);
</pre>
<pre class="brush: vb;">
' VB.NET

client.Connect(&quot;mail.example.com&quot;, 999)
</pre>
<p>If you are using SSL:</p>
<pre class="brush: csharp;">
// C#

client.ConnectSSL(&quot;mail.example.com&quot;, 999);
</pre>
<pre class="brush: vb;">
' VB.NET

client.ConnectSSL(&quot;mail.example.com&quot;, 999)
</pre>
<p>If you need to specify different port using fluent interface use OnPort() method:</p>
<pre class="brush: csharp;">
// C# version

Mail.Text(@&quot;Hello&quot;)
  .To(&quot;to@mail.com&quot;)
  .From(&quot;from@mail.com&quot;)
  .Subject(&quot;Subject&quot;)
  .UsingNewSmtp()
  .Server(_server)
  .WithSSL()
  .OnPort(443)
  .WithCredentials(&quot;user&quot;, &quot;password&quot;)
  .Send();
</pre>
<p>Some servers require explicit SSL (Usually this triggers &#8220;The handshake failed due to an unexpected packet format&#8221; exception) please look at following articles for details:</p>
<ul>
<li><a href="http://www.limilabs.com/blog/use-ssl-with-imap">Use SSL with IMAP</a></li>
<li><a href="http://www.limilabs.com/blog/use-ssl-with-pop3">Use SSL with POP3</a></li>
<li><a href="http://www.limilabs.com/blog/use-ssl-with-smtp">Use SSL with SMTP</a></li>
</ul>
<p>If you have problems with SSL, your server may be using self-signed certificates:</p>
<ul>
<li><a href="http://www.limilabs.com/blog/the-remote-certificate-is-invalid-according-to-the-validation-procedure">The remote certificate is invalid according to the validation procedure</a></li>
</ul>
<p>Again when in doubt<strong> please ask your email server administrator for server, port, and SSL usage</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/connection-attempt-failed/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

