Launchers and choosers – Email Tasks in Windows phone app

This is the second blog post of this series in which I am going to tell you about different Email tasks in windows phone application.

In this post I shall be discussing about three different tasks which are

 1. SaveEmailAddressTask

2. EmailAddressChooserTask

3. EmailComposeTask

 

1. First of all create a new Project having the name Emailtask.

 


 

2. Before going further add the following namespace in the MainPage.xaml.cs.This namespace is required for email tasks in windows phone app.

 

 

3. If you want to save an email address you can use the SaveEmailAddressTask in windows phone.

 

SaveEmailAdress Task

It allows your application to launch the Contacts application and enables users to save a new email address to the Contact lsit. This is done by calling the Show() method of the SaveEmailAddressTask  object. You can obtain the result of the chooser operation by handling the Completed event.

Create a button on the MainPage to launch the task and check its result in task completed event handler. The code for the click event handler of this button is given below.

 

 

The code for Task completed event Handlers is as follows.

 

 

EmailComposeTask

This launcher (EmailComposeTask) allows you to send email from your application by launching the Email application which displays a new email message.

Create a button on the MainPage to launch this task. The code for the click event handler of this button is given below.

 

 

It has got different properties which are self-understood.

 

EmailAddressChooserTask

Choosing email address from the existing ones can be just so easily implemented through the EmailAddressChooserTask. It launches the phone contacts application and allows the user to select particular email address.

Create a button on the MainPage to launch this task. The code for the click event handler of this button is given below.

 

 

The code for the Task completed event Handlers is given below. The email address to which email has to be sent has been changed to that selected from the contact list.

 

 


 

4. I hope this post will be helpful to you. You can download the full project source file from the link given below.

 
Download Full Project Source file EmailTaks.zip