How to compose and send an email by use the device’s default email app

This sample code describes how to send email via the device’s default mail app, before do this you need to configure an email account on the email app. Attention: This privilege should be included into the manifest xml file http://tizen.org/privilege/appmanager.launch
app_control_h app_control;
char *mail_address = "mail_name@mail_server";
char *subject = "Tutorial message";
char *message = "Tutorial message content.";

app_control_create(&app_control);
app_control_set_operation(app_control, APP_CONTROL_OPERATION_COMPOSE);
app_control_set_app_id(app_control, "email-composer-efl");
app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, message);
app_control_add_extra_data(app_control, APP_CONTROL_DATA_TO, mail_address);
app_control_add_extra_data(app_control, APP_CONTROL_DATA_SUBJECT, subject);
if (app_control_send_launch_request(app_control, NULL, NULL) == APP_CONTROL_ERROR_NONE)
{
    dlog_print(DLOG_INFO, LOG_TAG, "Succeeded to launch e-mail app.");
}
else
{
dlog_print(DLOG_INFO, LOG_TAG, "Failed to launch e-mail app.");
}
app_control_destroy(app_control);

Responses

0 Replies