You can access the email infrastructure to allow the user to exchange digital messages. Email systems are based on a store-and-forward model, in which email server computer systems accept, forward, deliver, and store messages on behalf of users, who only need to connect to the email infrastructure, typically an email server, with a network-enabled device for the duration of message submission or retrieval.
The main feature of the Tizen.Messaging.Email namespace is email message sending. You can connect to an email server, and compose, save, and send email messages using SMTP.
The Tizen.Messaging.Email namespace can be utilized by any component in the application layer which helps the device user to manage email messaging. For example, the Email methods can be invoked by a multimedia module when the user wants to send a media file through email, or by an email application when the user tries to send an email message.
To enable your application to use the email functionality:
To use the Tizen.Messaging.Email namespace, the application has to request permission by adding the following privilege to the
<privileges> <privilege>http://tizen.org/privilege/email</privilege> </privileges>
To use the methods and properties of the Tizen.Messaging.Email namespace, include it in your application:C#Copy
To send an email message:
Create the email message with an instance of the Tizen.Messaging.Email.EmailMessage class, and set the message subject:C#Copy
var email = new EmailMessage(); email.Subject = "CSAPI_SUBJECT";
Create a recipient with an instance of the Tizen.Messaging.Email.EmailRecipient class, set the recipient address, and add the recipient to the message:C#Copy
var recipient = new EmailRecipient(); string address = "firstname.lastname@example.org"; recipient.Address = address; email.To.Add(recipient);
Create an attachment with an instance of the Tizen.Messaging.Email.EmailAttachment class, set the attachment path, and add the attachment to the message:C#Copy
var attachment = new EmailAttachment(); string filepath = "CSAPI_FILEPATH"; attachment.FilePath = filepath; email.Attachments.Add(attachment);
Send the email with the
SendAsync()method of the Tizen.Messaging.Email.EmailSender class:C#Copy
var result = await EmailSender.SendAsync(email);
- Tizen 4.0 and Higher