posts - 82, comments - 0, trackbacks - 0

My Links

News

Archives

Post Categories

C# Download

Facebook

Informativa cookie

Linkedin

Microsoft

Msdn Gallery

Twitter

VisualBasic

Wiki Tecknet

Send Email with WindowsPhone

This example shows how to send email using a device with WindowsPhone.

To try this example and must have a telephone system operating WindowsPhone8, alternatively you can try it with VisualStudio and the emulator WWGA512 mb, but without the ability to send email.

With WindowsPhone 7 and 8 and not only can send Email directly from the device, but also creating our application of any type, but with the need to send email to this Microsoft gives us the class EmailComposeTask. This class provides several properties to be implemented in its entirety in order to competare everything you need to successfully send the email. Let's see one by one and see their work, the Bcc property, this property gets or sets the recipients in the Bcc line of the e-mail, the Body property gets or sets the body of the e-mail, the property gets or Cc sets the recipients in the Cc line of the e-mail, the CodePage property gets or sets the character set that will be used to display the contents of the message, the Subject property gets or sets the subject of the e-mail and finally the properties to get or set the recipients in the To line of the e-mail. There are some methods that make up the class EmailComposeTask, we will focus on the Show () method, this method allows you to start the providers installed on the device such as Hotmail, but if there are more on our device providers will all be listed and the user can choose the one he wants to send the email. Place the following piece of code and minimum required in order to send an email.  

//netFramework dll
using System.Windows;
using Microsoft.Phone.Tasks;

//Namespace EmailSample
namespace EmailSample
{
    public partial class MainPage
    {
        // Constructor
        public MainPage()
        {
            //Method InitializeComponent
            InitializeComponent();
        }

        //Click event BtnsendClick
        private void BtnsendClick(object sender, RoutedEventArgs e)
        {
            // Create a new instance of the class EmailComposeTask with which you can send email
            var emailcomposer = new EmailComposeTask
            {
                // I enter the recipients to send the email using the To property of the class EmailComposeTask
                To = string.Concat("mailto:",txtEmail.Text),

                // Set the title of the property by Subject
                Subject = "Email Sample",

                // Enhanced the value of the Body property EmailComposeTask class, this is the content that will display the recipient
                Body = txtEmail.Text,
            };

            // Start the email application on your device to send the Email
            emailcomposer.Show();
        }
    }
}

For more information please contact us at  carmelolm78@live.it

Print | posted on lunedì 11 marzo 2013 22:37 | Filed Under [ Articles C# in English ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 5 and 8 and type the answer here:

Powered by:
Powered By Subtext Powered By ASP.NET