<?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; VB.NET</title>
	<atom:link href="http://www.limilabs.com/blog/tag/vb-net/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>Folder access with IMAP</title>
		<link>http://www.limilabs.com/blog/folder-access-with-imap?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=folder-access-with-imap</link>
		<comments>http://www.limilabs.com/blog/folder-access-with-imap#comments</comments>
		<pubDate>Tue, 15 May 2012 13:17:09 +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[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2827</guid>
		<description><![CDATA[This article describes how to access different folder then inbox using Mail.dll IMAP library. In most cases the first thing you need from an IMAP server is to access INBOX folder. Mail.dll has a special method for that, as this is the only folder that must exist on every IMAP server. It&#8217;s Imap.SelectInbox. Most servers, [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes how to access different folder then inbox using Mail.dll <a href="http://www.limilabs.com/mail">IMAP library</a>.</p>
<p>In most cases the first thing you need from an IMAP server is to access INBOX folder. Mail.dll has a special method for that, as this is the only folder that must exist on every IMAP server. It&#8217;s <em>Imap.SelectInbox</em>.</p>
<p>Most servers, of course, allow client to access more folders. You can <a href="http://www.limilabs.com/blog/list-all-folders-using-imap">list all IMAP folders</a> using <em>Imap.GetFolders</em> method.</p>
<p>If you want to <strong>access different IMAP folder</strong> than Inbox, you need to use overloaded <em>Imap.Select </em>method which takes string parameter (folder name) or <em>FolderInfo </em> parameter (returned from a call to <em>Imap.GetFolders</em> method).</p>
<p>After that you can use <em>GetAll</em>, <em>Search</em> and <em>GetMessageByUID</em> methods to search and download email messages.</p>
<pre class="brush: csharp;">
// C#

using (Imap imap = new Imap())
{
    imap.Connect(&quot;imap.example.com&quot;);    // or ConnectSSL for SSL
    imap.Login(&quot;user&quot;, &quot;password&quot;);

    imap.Select(&quot;Sent items&quot;);

    Console.WriteLine(
        &quot;There are {0} messages in 'Sent items'&quot;,
        imap.GetAll().Count);

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

Using imap As New Imap()
	imap.Connect(&quot;imap.example.com&quot;)	' or ConnectSSL for SSL
	imap.Login(&quot;user&quot;, &quot;password&quot;)

	imap.[Select](&quot;Sent items&quot;)

	Console.WriteLine( _
		&quot;There are {0} messages in 'Sent items'&quot;, _
		imap.GetAll().Count)

	imap.Close()
End Using
</pre>
<p>There is<strong> no established standard on naming common IMAP folders</strong> like &#8216;Sent mail&#8217;, &#8216;Spam&#8217; etc. However some servers support XLIST command (Gmail) or SpecialUse extension that allow to <a href="http://www.limilabs.com/blog/common-imap-folders">identify common folders on this particular IMAP server</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/folder-access-with-imap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Common IMAP folders</title>
		<link>http://www.limilabs.com/blog/common-imap-folders?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=common-imap-folders</link>
		<comments>http://www.limilabs.com/blog/common-imap-folders#comments</comments>
		<pubDate>Thu, 19 Apr 2012 14:56:18 +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[SPECIAL-USE]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[XLIST]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2647</guid>
		<description><![CDATA[There are no well-know names for common folders such as Drafts, Trash, Spam, &#8230; defined in IMAP protocol standards. This makes quite difficult for an IMAP client to know the real purpose of the folders on the server. Fortunately there are two IMAP protocol extensions: XLIST &#8211; supported by Gmail SPECIAL-USE &#8211; RFC standardized extension [...]]]></description>
			<content:encoded><![CDATA[<p>There are <strong>no well-know names for common folders</strong> such as Drafts, Trash, Spam, &#8230; defined in IMAP protocol standards.</p>
<p>This makes quite difficult for an <a href="http://www.limilabs.com/mail">IMAP client</a> to know the real purpose of the folders on the server.</p>
<p>Fortunately there are two IMAP protocol extensions:</p>
<ul>
<li> <a href="http://www.limilabs.com/blog/localized-gmail-imap-folders"><strong>XLIST </strong> &#8211; supported by Gmail</a></li>
<li> <strong>SPECIAL-USE</strong> &#8211; RFC standardized extension</li>
</ul>
<p>You can check if your servers support it by <a href="http://www.limilabs.com/blog/get-supported-server-extensions-imap-pop3-smtp">checking if <em>SupportedExtensions</em> returns <em>ImapExtension.XList</em> or <em>ImapExtension.SpecialUse</em></a></p>
<p>Both extensions are supported by Mail.dll and, if your server supports any of them, you can take advantage of <em>CommonFolders </em>class. <em>CommonFolders</em> allows you to get the name of the folder and <em>Select </em>it, by knowing its purpose (for example Spam folder may be called &#8220;Junk email&#8221; on the server).</p>
<pre class="brush: csharp;">
// C# version:

using (Imap imap = new Imap())
{
    imap.ConnectSSL(&quot;imap.gmail.com&quot;);
    imap.Login(&quot;pat@gmail.com&quot;, &quot;password&quot;);

    CommonFolders folders = new CommonFolders(imap.GetFolders());

    Console.WriteLine(&quot;Inbox folder: &quot; + folders.Inbox.Name);
    Console.WriteLine(&quot;Sent folder: &quot; + folders.Sent.Name);
    Console.WriteLine(&quot;Spam folder: &quot; + folders.Spam.Name);

    // You can select folders easy:
    imap.Select(folders.Inbox);
    imap.Select(folders.Sent);
    imap.Select(folders.Spam);

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

Using imap As New Imap()
    imap.ConnectSSL(&quot;imap.gmail.com&quot;)
    imap.Login(&quot;pat@gmail&quot;, &quot;password&quot;)

    Dim folders As New CommonFolders(imap.GetFolders())

    Console.WriteLine(&quot;Inbox folder: &quot; + folders.Inbox.Name)
    Console.WriteLine(&quot;Sent folder: &quot; + folders.Sent.Name)

    ' You can select folders easy:
    imap.Select(folders.Inbox)
    imap.Select(folders.Sent)

    imap.Close()
End Using
</pre>
<p>You can check if you can use <em>CommonFolders </em>with following code:</p>
<pre class="brush: csharp;">
// C#

List&lt;ImapExtension&gt; extensions = client.SupportedExtensions();
bool canUseCommonFolders = extensions.Contains(ImapExtension.XList)
    || extensions.Contains(ImapExtension.SpecialUse);
</pre>
<pre class="brush: vb;">
' VB.NET

Dim extensions As List(Of ImapExtension) = client.SupportedExtensions()
Dim canUseCommonFolders As Boolean = extensions.Contains(ImapExtension.XList) OrElse extensions.Contains(ImapExtension.SpecialUse)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/common-imap-folders/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create HTML from plain text email</title>
		<link>http://www.limilabs.com/blog/create-html-from-plain-text-email?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-html-from-plain-text-email</link>
		<comments>http://www.limilabs.com/blog/create-html-from-plain-text-email#comments</comments>
		<pubDate>Thu, 12 Apr 2012 09:23:07 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2629</guid>
		<description><![CDATA[Mail.dll MIME and email component may be used to retrieve plain-text body or HTML body from an email message. If a message contains HTML, no conversion is necessary. You just need to use HTML property of IMail interface. If however an email does not contain HTML and only plain-text content is available, many times plain-text [...]]]></description>
			<content:encoded><![CDATA[<p>Mail.dll MIME and <a href="http://www.limilabs.com/mail">email component</a> may be used to retrieve plain-text body or HTML body from an email message.</p>
<p>If a message contains HTML, no conversion is necessary. You just need to use <em>HTML </em>property of <em>IMail </em>interface.</p>
<p>If however an email does not contain HTML and only plain-text content is available, many times plain-text needs be converted to HTML.</p>
<p>You can use <strong>GetBodyAsHtml</strong> method that<strong> always returns body in HTML format</strong> (it uses <em>IMail.HTML</em> property or creates valid HTML from <em>IMail.Text</em>).</p>
<pre class="brush: csharp;">
// C#

IMail email = ...

string html = email.GetBodyAsHtml();
Console.WriteLine(html);
</pre>
<pre class="brush: vb;">
' VB.NET

Dim email As IMail = ...

Dim html As String = email.GetBodyAsHtml()
Console.WriteLine(html)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/create-html-from-plain-text-email/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Label message with Gmail system label (e.g. Starred)</title>
		<link>http://www.limilabs.com/blog/label-message-with-gmail-system-label-starred?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=label-message-with-gmail-system-label-starred</link>
		<comments>http://www.limilabs.com/blog/label-message-with-gmail-system-label-starred#comments</comments>
		<pubDate>Sat, 31 Mar 2012 07:08:40 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[X-GM-LABELS]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2565</guid>
		<description><![CDATA[If you want to use user-defined label please read label message with user defined label. There are two ways of labeling message with Gmail system label (e.g. Starred) Imap.GmailLabelMessageByUID method GmailLabelMessageByUID method uses Gmail&#8217;s X-GM-LABELS extension to the IMAP protocol. You need to provide a folder flag name for it to work correctly e.g. @&#8221;\Starred&#8221;. [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to use user-defined label please read <a href="http://www.limilabs.com/blog/label-message-with-gmail-label">label message with user defined label</a>.</p>
<p>There are two ways of labeling message with Gmail system label (e.g. Starred)</p>
<h2>Imap.GmailLabelMessageByUID method</h2>
<p><em>GmailLabelMessageByUID </em>method uses Gmail&#8217;s <strong>X-GM-LABELS</strong> extension to the IMAP protocol. You need to provide a folder flag name for it to work correctly e.g. @&#8221;\Starred&#8221;.</p>
<p>You can use FolderFlag class static properties to get common flags:<br />
<em>FolderFlag.XImportant</em>, <em>FolderFlag.XSpam</em>, <em>FolderFlag.XStarred</em>.</p>
<pre class="brush: csharp;">
// C#

using (Imap imap = new Imap())
{
    imap.ConnectSSL(&quot;imap.gmail.com&quot;);
    imap.Login(&quot;pat@gmail.com&quot;, &quot;password&quot;);

    imap.SelectInbox();
    long last = imap.GetAll().Last();

    imap.GmailLabelMessageByUID(last, FolderFlag.XStarred.Name);

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

Using imap As New Imap()
    imap.ConnectSSL(&quot;imap.gmail.com&quot;)
    imap.Login(&quot;pat@gmail.com&quot;, &quot;password&quot;)

    imap.SelectInbox()
    Dim last As Long = imap.GetAll().Last()

    imap.GmailLabelMessageByUID(last, FolderFlag.XStarred.Name)

    imap.Close()
End Using
</pre>
<h2>Imap.CopyByUID method</h2>
<p>The second method basis on the fact that <strong>Gmail treats labels as regular IMAP folders</strong>.<br />
You just need to know correct folder name and copy the message to this folder.</p>
<p>You can use <em>CommonFolders </em>class to get common folders:</p>
<pre class="brush: csharp;">
// C#

using (Imap imap = new Imap())
{
    imap.ConnectSSL(&quot;imap.gmail.com&quot;);
    imap.Login(&quot;pat@gmail.com&quot;, &quot;password&quot;);

    List&lt;FolderInfo&gt; folders = imap.GetFolders();

    imap.SelectInbox();
    long last = imap.GetAll().Last();

    imap.CopyByUID(last, new CommonFolders(folders).Starred);

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

Using imap As New Imap()
    imap.ConnectSSL(&quot;imap.gmail.com&quot;)
    imap.Login(&quot;pat@gmail.com&quot;, &quot;password&quot;)

    Dim folders As List(Of FolderInfo) = imap.GetFolders()

    imap.SelectInbox()
    Dim last As Long = imap.GetAll().Last()

    imap.CopyByUID(last, New CommonFolders(folders).Starred)

    imap.Close()
End Using
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/label-message-with-gmail-system-label-starred/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List all Gmail labels</title>
		<link>http://www.limilabs.com/blog/list-all-gmail-labels?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=list-all-gmail-labels</link>
		<comments>http://www.limilabs.com/blog/list-all-gmail-labels#comments</comments>
		<pubDate>Fri, 30 Mar 2012 10:32:39 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[X-GM-LABELS]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2566</guid>
		<description><![CDATA[Gmail treats labels as folders for the purposes of IMAP. As such, labels can be modified using the standard IMAP commands, CreateFolder, RenameFolder, and DeleteFolder, that act on folders. System labels, which are labels created by Gmail, are reserved and prefixed by &#8220;[Gmail]&#8221; or &#8220;[GoogleMail]&#8221; in the list of labels. // C# using (Imap imap [...]]]></description>
			<content:encoded><![CDATA[<p>Gmail treats labels as folders for the purposes of IMAP.</p>
<p>As such, labels can be modified using the standard IMAP commands, <a href="http://www.limilabs.com/blog/folder-management-using-imap-create-delete-rename">CreateFolder, RenameFolder, and DeleteFolder</a>, that act on folders.</p>
<p>System labels, which are labels created by Gmail, are reserved and prefixed by &#8220;[Gmail]&#8221; or &#8220;[GoogleMail]&#8221; in the list of labels.</p>
<pre class="brush: csharp;">
// C#

using (Imap imap = new Imap())
{
    imap.ConnectSSL(&quot;imap.gmail.com&quot;);
    imap.Login(&quot;pat@gmail.com&quot;, &quot;password&quot;);

    List&lt;FolderInfo&gt; folders = imap.GetFolders();
    List&lt;FolderInfo&gt; system = folders.FindAll(x =&gt; x.Name.StartsWith(&quot;[Gmail]&quot;));
    List&lt;FolderInfo&gt; user = folders.FindAll(x =&gt; !x.Name.StartsWith(&quot;[Gmail]&quot;));

    Console.WriteLine(&quot;System labels:&quot;);
    system.ForEach(x =&gt; Console.WriteLine(x.Name));
    Console.WriteLine();
    Console.WriteLine(&quot;User labels:&quot;);
    user.ForEach(x =&gt; Console.WriteLine(x.Name));

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

Using imap As New Imap()
    imap.ConnectSSL(&quot;imap.gmail.com&quot;)
    imap.Login(&quot;pat@gmail.com&quot;, &quot;password&quot;)

    Dim folders As List(Of FolderInfo) = imap.GetFolders()
    Dim system As List(Of FolderInfo) =
        folders.FindAll(Function(x) x.Name.StartsWith(&quot;[Gmail]&quot;))
    Dim user As List(Of FolderInfo) =
        folders.FindAll(Function(x) Not x.Name.StartsWith(&quot;[Gmail]&quot;))

    Console.WriteLine(&quot;System labels:&quot;)
    system.ForEach(Function(x) Console.WriteLine(x.Name))
    Console.WriteLine()
    Console.WriteLine(&quot;User labels:&quot;)
    user.ForEach(Function(x) Console.WriteLine(x.Name))

    imap.Close()
End Using
</pre>
<p>Here is the output:</p>
<p><code><br />
System labels:<br />
[Gmail]<br />
[Gmail]/All Mail<br />
[Gmail]/Drafts<br />
[Gmail]/Sent Mail<br />
[Gmail]/Spam<br />
[Gmail]/Starred<br />
[Gmail]/Trash<br />
</code></p>
<p><code><br />
User labels:<br />
my label<br />
my label/nested<br />
my second label<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/list-all-gmail-labels/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Receive vCard business card</title>
		<link>http://www.limilabs.com/blog/receive-vcard-business-card?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=receive-vcard-business-card</link>
		<comments>http://www.limilabs.com/blog/receive-vcard-business-card#comments</comments>
		<pubDate>Sat, 03 Mar 2012 12:18:25 +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[VB.NET]]></category>
		<category><![CDATA[vCard]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2535</guid>
		<description><![CDATA[Mail.dll .NET email component makes receiving vCard business cards easy. IMail object exposes VCards collection that contains all vCard business cards that were found while parsing an email. You can use both IMAP or POP3 protocol to download email from the server. Here&#8217;s the simple sample showing how to process VCard business cards: // C# [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.limilabs.com/mail">Mail.dll .NET email component</a> makes receiving vCard business cards easy.</p>
<p><em>IMail</em> object exposes <em>VCards</em> collection that contains all vCard business cards that were found while parsing an email.</p>
<p>You can use both IMAP or POP3 protocol to <a href="http://www.limilabs.com/blog/receive-unseen-emails-using-imap">download email from the server</a>.</p>
<p>Here&#8217;s the simple sample showing how to process VCard business cards:</p>
<pre class="brush: csharp;">
// C#

IMail email = new MailBuilder().CreateFromEml(client.GetMessageByUID(uid));

foreach (VCard vCard in email.VCards)
{

    Console.WriteLine(&quot;first name: &quot; + vCard.Name.FirstName);
    Console.WriteLine(&quot;last name: &quot; + vCard.Name.LastName);
    Console.WriteLine(&quot;full name: &quot; + vCard.FullName);

    Console.WriteLine(&quot;email: &quot; + vCard.Email);
    Console.WriteLine(&quot;work phone: &quot; + vCard.WorkPhone);
    Console.WriteLine(&quot;home phone: &quot; + vCard.HomePhone);

    if (vCard.WorkAddress != null)
    {
        Console.WriteLine(vCard.WorkAddress.PostOfficeBox);
        Console.WriteLine(vCard.WorkAddress.ApartmentNumber);
        Console.WriteLine(vCard.WorkAddress.Street);
        Console.WriteLine(vCard.WorkAddress.City);
        Console.WriteLine(vCard.WorkAddress.Region);
        Console.WriteLine(vCard.WorkAddress.PostalCode);
        Console.WriteLine(vCard.WorkAddress.Country);
    }
    if (vCard.HomeAddress != null)
    {
        //...
    }

    foreach (VCardPhone phone in vCard.Phones)
    {
        Console.WriteLine(&quot;phone: &quot; + phone.Value);
    }
    foreach (VCardAddress address in vCard.Addresses)
    {
        Console.WriteLine(&quot;street: &quot; + address.Street);
    }
    foreach (VCardEmail mail in vCard.Emails)
    {
        Console.WriteLine(&quot;email: &quot; + mail.Value);
    }
}
</pre>
<pre class="brush: vb;">
' VB.NET

Dim email As IMail = New MailBuilder().CreateFromEml(client.GetMessageByUID(uid))

For Each vCard As VCard In email.VCards

	Console.WriteLine(&quot;first name: &quot; + vCard.Name.FirstName)
	Console.WriteLine(&quot;last name: &quot; + vCard.Name.LastName)
	Console.WriteLine(&quot;full name: &quot; + vCard.FullName)

	Console.WriteLine(&quot;email: &quot; + vCard.Email)
	Console.WriteLine(&quot;work phone: &quot; + vCard.WorkPhone)
	Console.WriteLine(&quot;home phone: &quot; + vCard.HomePhone)

	If vCard.WorkAddress IsNot Nothing Then
		Console.WriteLine(vCard.WorkAddress.PostOfficeBox)
		Console.WriteLine(vCard.WorkAddress.ApartmentNumber)
		Console.WriteLine(vCard.WorkAddress.Street)
		Console.WriteLine(vCard.WorkAddress.City)
		Console.WriteLine(vCard.WorkAddress.Region)
		Console.WriteLine(vCard.WorkAddress.PostalCode)
		Console.WriteLine(vCard.WorkAddress.Country)
	End If
			'...
	If vCard.HomeAddress IsNot Nothing Then
	End If

	For Each phone As VCardPhone In vCard.Phones
		Console.WriteLine(&quot;phone: &quot; + phone.Value)
	Next
	For Each address As VCardAddress In vCard.Addresses
		Console.WriteLine(&quot;street: &quot; + address.Street)
	Next
	For Each mail As VCardEmail In vCard.Emails
		Console.WriteLine(&quot;email: &quot; + mail.Value)
	Next
Next
</pre>
<p>You can learn here how to <a href="http://www.limilabs.com/blog/send-vcard-business-card">send email with VCard</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/receive-vcard-business-card/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Receive iCalendar meeting request</title>
		<link>http://www.limilabs.com/blog/receive-icalendar-meeting-request?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=receive-icalendar-meeting-request</link>
		<comments>http://www.limilabs.com/blog/receive-icalendar-meeting-request#comments</comments>
		<pubDate>Mon, 30 Jan 2012 09:16:46 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[iCalendar]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2533</guid>
		<description><![CDATA[Mail.dll .NET email component makes receiving iCalendar meeting request fairly easy. IMail object exposes Appointments collection that contains all appointments that were found while parsing an email. You can use both IMAP or POP3 protocol to download email from the server. Here&#8217;s the simple sample showing how to process iCalendar appointments: // C# IMail email [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.limilabs.com/mail">Mail.dll .NET email component</a> makes receiving iCalendar meeting request fairly easy.</p>
<p><em>IMail</em> object exposes <em>Appointments</em> collection that contains all appointments that were found while parsing an email.</p>
<p>You can use both IMAP or POP3 protocol to <a href="http://www.limilabs.com/blog/receive-unseen-emails-using-imap">download email from the server</a>.</p>
<p>Here&#8217;s the simple sample showing how to process iCalendar appointments:</p>
<pre class="brush: csharp;">
// C#

IMail email = new MailBuilder().CreateFromEml(client.GetMessageByUID(uid));

foreach (Appointment appointment in email.Appointments)
{
    if (appointment.Method == Method.Request)
    {
        // appointment was created
        string summary = appointment.Event.Summary;
        DateTime? start = appointment.Event.Start;
        DateTime? end = appointment.Event.End;
        string location = appointment.Event.Location;

        Console.WriteLine(&quot;{0} at {1} ({2}-{3})&quot;, summary, location, start, end);

        foreach (Participant participant in appointment.Event.Participants)
        {
            Console.WriteLine(&quot;Common name: &quot; + participant.Cn);
            Console.WriteLine(&quot;Email: &quot; + participant.Email);
            Console.WriteLine(&quot;Participation status: &quot; + participant.Status);
        }
    }
    else if (appointment.Method == Method.Cancel)
    {
        // appointment was canceled
        Console.WriteLine(&quot;Event was cancelled: &quot; + appointment.Event.UID);

    }
    else if (appointment.Method == Method.Reply)
    {
        // someone replied to the request
        foreach (Participant participant in appointment.Event.Participants)
        {
            if (participant.Status == ParticipationStatus.Accepted)
                Console.WriteLine(&quot;Event was accepted by: &quot; + participant.Email);
            else if (participant.Status == ParticipationStatus.Declined)
                Console.WriteLine(&quot;Event was declined by: &quot; + participant.Email);
        }

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

Dim email As IMail = New MailBuilder().CreateFromEml(client.GetMessageByUID(uid))

For Each appointment As Appointment In email.Appointments
	If appointment.Method = Method.Request Then
		' appointment was created
		Dim summary As String = appointment.[Event].Summary
		Dim start As System.Nullable(Of DateTime) = appointment.[Event].Start
		Dim [end] As System.Nullable(Of DateTime) = appointment.[Event].[End]
		Dim location As String = appointment.[Event].Location

		Console.WriteLine(&quot;{0} at {1} ({2}-{3})&quot;, summary, location, start, [end])

		For Each participant As Participant In appointment.[Event].Participants
			Console.WriteLine(&quot;Common name: &quot; + participant.Cn)
			Console.WriteLine(&quot;Email: &quot; + participant.Email)
			Console.WriteLine(&quot;Participation status: &quot; + participant.Status)
		Next
	ElseIf appointment.Method = Method.Cancel Then
		' appointment was canceled

		Console.WriteLine(&quot;Event was cancelled: &quot; + appointment.[Event].UID)
	ElseIf appointment.Method = Method.Reply Then
		' someone replied to the request
		For Each participant As Participant In appointment.[Event].Participants
			If participant.Status = ParticipationStatus.Accepted Then
				Console.WriteLine(&quot;Event was accepted by: &quot; + participant.Email)
			ElseIf participant.Status = ParticipationStatus.Declined Then
				Console.WriteLine(&quot;Event was declined by: &quot; + participant.Email)
			End If

		Next
	End If
Next
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/receive-icalendar-meeting-request/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>Extract plain text from HTML email</title>
		<link>http://www.limilabs.com/blog/extract-plain-text-from-html-email?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extract-plain-text-from-html-email</link>
		<comments>http://www.limilabs.com/blog/extract-plain-text-from-html-email#comments</comments>
		<pubDate>Tue, 27 Dec 2011 16:59:24 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Mail.dll]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=2185</guid>
		<description><![CDATA[Mail.dll MIME and email API’s may be used to get the plain-text body and HTML body from an email message. If a message contains plain-text, no conversion is necessary. It’s simply a matter of using the Text property of IMail interface. If however the email does not contain plain-text and only HTML content is available, [...]]]></description>
			<content:encoded><![CDATA[<p>Mail.dll MIME and email API’s may be used to get the plain-text body and HTML body from an email message.</p>
<p>If a message contains plain-text, no conversion is necessary. It’s simply a matter of using the <em>Text </em>property of <em>IMail </em>interface.</p>
<p>If however the email does not contain plain-text and only HTML content is available, <strong>GetTextFromHtml </strong>method may be used to <strong>convert the HTML to plain-text</strong>.</p>
<p>The internal conversion process is much more sophisticated than what can be accomplished with the simple regular-expression code. Converting HTML to plain text is much more than simply removing HTML tags from an HTML document.</p>
<p>Mail.dll contains <strong>full-blown HTML parser</strong> that handles script tags, comments, CDATA and even incorrect HTML.</p>
<p>The following C# and VB.NET code extracts plain-text from the HTML body of the email message:</p>
<pre class="brush: csharp;">
// C#

IMail email = ...

string text = &quot;&quot;;
if (email.IsText)
    text = email.Text;
else if (email.IsHtml)
    text = email.GetTextFromHtml();
Console.WriteLine(text);
</pre>
<pre class="brush: vb;">
' VB.NET

Dim email As IMail = ...

Dim text As String = &quot;&quot;
If email.IsText Then
    text = email.Text
ElseIf email.IsHtml Then
    text = email.GetTextFromHtml()
End If
Console.WriteLine(text)
</pre>
<p>You can also use <strong>GetBodyAsText </strong>method that<strong> returns body in plain text format</strong> (it uses <em>IMail.Text</em> property or <em>GetTextFromHtml</em> method).</p>
<pre class="brush: csharp;">
// C#

IMail email = ...

string text = email.GetBodyAsText();
Console.WriteLine(text);
</pre>
<pre class="brush: vb;">
' VB.NET

Dim email As IMail = ...

Dim text As String = email.GetBodyAsText()
Console.WriteLine(text)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/extract-plain-text-from-html-email/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

