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:
You can attach files also while sending email to attach the files write the below code before compose the email task.
To send SMS
To send an SMS write the below code:
To send E-mail
First we are going to see how to send email .Write the below code:
- private async void ComposeEmail(Contact Torecipient, string messageBody)
- {
- var to = Torecipient.Emails.FirstOrDefault < Windows.ApplicationModel.Contacts.ContactEmail > ();
- var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(to.Address);
- EmailMessage objEmail = new EmailMessage();
- objEmail.Subject = "Suresh";
- objEmail.To.Add(emailRecipient);
- await EmailManager.ShowComposeNewEmailAsync(objEmail);
- }
- var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachment);
- var attachment = new Windows.ApplicationModel.Email.EmailAttachment(
- attachment.Name,
- stream);
- emailMessage.Attachments.Add(attachment);
To send an SMS write the below code:
- private async void ComposeSMS(Contact toContatc, string message)
- {
- var chatMessage = new Windows.ApplicationModel.Chat.ChatMessage();
- chatMessage.Body = message;
- var phone = toContatc.Phones.FirstOrDefault < Windows.ApplicationModel.Contacts.ContactPhone > ();
- chatMessage.Recipients.Add(phone.Number);
- await Windows.ApplicationModel.Chat.ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);
- }

Join the conversation! Your thoughts help the community grow.