NoteAll email APIs have been deprecated since Tizen 8.0 and will be removed after two releases without any alternatives.
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.
Prerequisites
To enable your application to use the email functionality, follow the steps below:
-
To use the
Tizen.Messaging.Email
namespace, the application has to request permission by adding the following privilege to thetizen-manifest.xml
file:XMLCopy<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#Copyusing Tizen.Messaging.Email;
Send an email
To send an email message, follow the steps below:
-
Create the email message with an instance of the Tizen.Messaging.Email.EmailMessage class, and set the message subject:
C#Copyvar 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#Copyvar recipient = new EmailRecipient(); string address = "example@mail.com"; 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#Copyvar 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#Copyvar result = await EmailSender.SendAsync(email);
Related information
- Dependencies
- Tizen 4.0 and Higher