I'm working on my own application for Windows Phone 7, like many people are. Part of the requirements I've set for my application is to let the users send the context of what they are working on to other people via SMS or Email. The reason being, that I'm not making my application work on Android or Iphone, but if the user can at least do their work in my app, and send the results to other users, it may be beneficial.
To send either an SMS or Email were going to use the same Namespace.
using Microsoft.Phone.Tasks;
Now, lets look at how easy it is to send an email from your Silverlight WP7 application.
private void btnSend_Click(object sender, RoutedEventArgs e)
{
EmailComposeTask ect = new EmailComposeTask();
ect.Body = "A really great source that provides the body for your email would go here";
ect.To = "somebody@email.com";
ect.Subject = "WP7 Email";
ect.Show();
}
The code above is obviously linked directly to a button click for simplicity of example. We've instantiated an EmailComposeTask, preset some values, and then used the Show method to the launch the email application. Provided the user has set up at least one or more email accounts, they will go through email task screens they at this point are most likely very familiar with. Prompted to choose an email account, and potentially just hit send based on the values you provided before launching the email application.
Sending an SMS is part of the same namespace and follows the same basic steps.
private void btnSendText_Click(object sender, RoutedEventArgs e)
{
SmsComposeTask sct = new SmsComposeTask();
sct.Body = "A great message that takes into account 160 character concepts goes here";
sct.To = "1235554567";
sct.Show();
}
Again, same general flow, task is instantiated, we can set some basic values, and then launch the corresponding task by using the "Show" method. This, like the email task, requires user interaction to be completed. This means they can also change the values preset by your application prior to sending, something to keep in mind when deciding to use these tasks.
Considering how simple these tasks where, I encourage you to review the many other tasks in the Microsoft.Phone.Tasks namespace. You'll see a lot of features have been simplified for you via these tasks, so please familiarize yourself with them before potentially reinventing the wheel.