Send vCard business card

You can also read how to:

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’s the simple sample showing how to send email with VCard business card:

// C#

// Create VCard business card

VCard vCard = new VCard();

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

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

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

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

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

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

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


// Create email message

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


// Send email message using SMTP protocol

using(Smtp smtp  = new Smtp())
{
    smtp.ConnectSSL("imap.example.com");
    smtp.UseBestLogin("user", "password");
    smtp.SendMessage(email);
    smtp.Close();
}
' VB.NET

' Create VCard business card

Dim vCard As New VCard()

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

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

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

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

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

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

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


' Create email message

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


' Send email message using SMTP protocol

Using smtp As New Smtp()
	smtp.ConnectSSL("imap.example.com")
	smtp.UseBestLogin("user", "password")
	smtp.SendMessage(email)
	smtp.Close()
End Using

Such email can be parsed and VCard extracted.

Receive vCard business card

You can also read how to:

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’s the simple sample showing how to process VCard business cards:

// C#

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

foreach (VCard vCard in email.VCards)
{

    Console.WriteLine("first name: " + vCard.Name.FirstName);
    Console.WriteLine("last name: " + vCard.Name.LastName);
    Console.WriteLine("full name: " + vCard.FullName);
    
    Console.WriteLine("email: " + vCard.Email);
    Console.WriteLine("work phone: " + vCard.WorkPhone);
    Console.WriteLine("home phone: " + 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("phone: " + phone.Value);
    }
    foreach (VCardAddress address in vCard.Addresses)
    {
        Console.WriteLine("street: " + address.Street);
    }
    foreach (VCardEmail mail in vCard.Emails)
    {
        Console.WriteLine("email: " + mail.Value);
    }
}
' VB.NET

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

For Each vCard As VCard In email.VCards

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

	Console.WriteLine("email: " + vCard.Email)
	Console.WriteLine("work phone: " + vCard.WorkPhone)
	Console.WriteLine("home phone: " + 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("phone: " + phone.Value)
	Next
	For Each address As VCardAddress In vCard.Addresses
		Console.WriteLine("street: " + address.Street)
	Next
	For Each mail As VCardEmail In vCard.Emails
		Console.WriteLine("email: " + mail.Value)
	Next
Next

You can learn here how to send email with VCard.

We’re changing our name from Lesnikowski to Limilabs

Limilabs logoWe are pleased to announce that we changed our name to Limilabs.

We continue to deliver same, great .NET components. The change is not in name only as at Limilabs we are also going to provide full lifecycle application development services for our customers.

It’s a pretty exciting time for our little company.

With a change like this, we thought it would be a good time to introduce a new website www.limilabs.com and do some namespace cleaning.

You will still get the same great service you’ve come to expect from lesnikowski.com.

Don’t worry if you forget the new web site address, after we finish the transition, you will be redirected to the new address automatically.

And since it’s not often that I get to post on non-technology related stuff, I thought I’d take the opportunity to say thank you to all of you readers, users and buyers who have supported us and helped us grow!

Thank You All, and I hope you’ll like the new name.

Create barcode in ASP.NET video

In this video you’ll learn how to:

  • Download and install Barcode.dll barcode ASP.NET component.
  • Create new ASP.NET application that references Barcode.dll barcode ASP.NET component.
  • Configure barcode ASP.NET handler.
  • Darg & drop barcode web control.
  • Configure barcode web control.
  • Program barcode control through code.

Enjoy:

Print barcode in WinForms video

In this video you’ll learn how to:

  • Download and install Barcode.dll barcode component.
  • Create new WinForms application that references Barcode.dll barcode component.
  • Darg & drop barcode windows control.
  • Configure barcode windows control.
  • Create print preview and print barcode.

Enjoy