How to Send E-mail and SMS in Windows 10

Create new Windows 10 project to know how to create windows 10 projects refer my previous article:

Now create two button one id for send email and one is for send SMS.

To send E-mail

First we are going to see how to send email .Write the below code:
  1. private async void ComposeEmail(Contact Torecipient, string messageBody)  
  2. {  
  3.     var to = Torecipient.Emails.FirstOrDefault < Windows.ApplicationModel.Contacts.ContactEmail > ();  
  4.     var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(to.Address);  
  5.     EmailMessage objEmail = new EmailMessage();  
  6.     objEmail.Subject = "Suresh";  
  7.     objEmail.To.Add(emailRecipient);  
  8.     await EmailManager.ShowComposeNewEmailAsync(objEmail);  
  9. }  
You can attach files also while sending email to attach the files write the below code before compose the email task.
  1. var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachment);  
  2.   
  3. var attachment = new Windows.ApplicationModel.Email.EmailAttachment(  
  4.     attachment.Name,  
  5.     stream);  
  6. emailMessage.Attachments.Add(attachment);  
To send SMS

To send an SMS write the below code:
  1. private async void ComposeSMS(Contact toContatc, string message)  
  2. {  
  3.     var chatMessage = new Windows.ApplicationModel.Chat.ChatMessage();  
  4.     chatMessage.Body = message;  
  5.     var phone = toContatc.Phones.FirstOrDefault < Windows.ApplicationModel.Contacts.ContactPhone > ();  
  6.     chatMessage.Recipients.Add(phone.Number);  
  7.     await Windows.ApplicationModel.Chat.ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);  
  8. }