gray laptop computer showing html codes in shallow focus photography

How to send email in Windows Phone 7 using c# ?

In one of my previous post , i wrote about how one can send SMS in Windows Phone 7  using c# . This blog post focusses on sending a email in windows phone 7 using c#

EmailComposeTask is a launcher that allows the windows phone 7 app to launch the email App aling with the message to be displayed which allows the users to send the email from your app.

How to send email in Windows Phone 7 using c# ?

Similar to sending SMS , sending email can be achieved with the EmailComposeTask

To use the EmailComposeTask , you must include the namespace Microsoft.Phone.Tasks .

Using Microsoft.Phone.Tasks ;
This namespace can be found in the Microsoft.Phone.dll
To send the email , create an instance of the EmailComposeTask and set the appropriate properties like
To , Subject and Body of the Email .
private void button1_Click(object sender, RoutedEventArgs e)
{
     EmailComposeTask emailcomposer = new EmailComposeTask();
     emailcomposer.To = "[email protected]";
     emailcomposer.Subject = "subject from test app";
     emailcomposer.Body = "This is a test mail from Email Composer";
     emailcomposer.Show();
}

When the Show method is called , the EmailComposer is opened which lets the user to click the send button to send the email
Note that you might the following message when email account is not set up in your windows phone 7 .

 

    3 Comments

  1. Nick Heiner
    August 9, 2011
    Reply

    You can actually be a bit more concise making the `EmailComposeTask`:

  2. Mike
    November 29, 2011
    Reply

    thanks for this this is about the only thing i’ve done in wp7 that was easy – worked on the first try, thanks!

  3. Rohit Baghela
    January 6, 2014
    Reply

    Can we capture and send a image Via mail Using C# in windows phone

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...