语言

Menu
Sites
Language
Send Email/SMS

Hi,

I want to send email/sms programatically from Tizen Web application.

I tried to ran the same code to send SMS given in Tisen documentation on Emulator. Following is the code that I am trying to execute. I can send Send Email on console after that I don't see any thing from messageSent, messageFailed or serviceErrorCB. Not sure what happening. 

 

 

function sendEmail(){
    console.log("Send Email");
    tizen.messaging.getMessageServices("messaging.sms",
                                    serviceListCB,
                                    serviceErrorCB);
}
 
// Define the success callback.
 function messageSent(recipients) {
   console.log("The SMS has been sent");
 }
 
 // Define the error callback.
 function messageFailed(error) {
   console.log("The SMS could not be sent " + error.message);
 }
 
 // Define service error callback.
 function serviceErrorCB(error) {
  console.log("Cannot get messaging service " + error.message);
 }
 
 // Define the success callback.
 function serviceListCB(services) {
   if (services.length > 0) {
     // SMS sending example
     var msg = new tizen.Message("messaging.sms", {plainBody:"I will arrive in 10 minutes.",
                                  to:["+34666666666"]});
     // Send request
     services[0].sendMessage(msg, messageSent, messageFailed);
   }
 }
编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

7 回复
Raghu Kona
For sending an email, you need to add an email account. We will try writing a sample app and get back.
Raghu Kona
You can send an email using the following code var appControl = new tizen.ApplicationControl( 'http://tizen.org/appcontrol/operation/send', null, "text/html", null, [new tizen.ApplicationControlData("mail", ["raghu@intel.com", "kona@wipro.com"])] ); console.log("Create service"); serviceCB = { onsuccess: function () { console.log('OK') }, onfailure: function () { } }; console.log("Launch service"); tizen.application.launchAppControl( appControl, "org.tizen.email", function() {console.log("launch application control succeed"); }, function(e) {console.log('launch appControl failed. Reason: ' + e.name)}, serviceCB ); It worked on the device. Prior to this, you need to configure the mail client.
Christian Soe
Hello, I think above sample works okay but how can we do when we want to add attachments to the email. Thanks. Christian.
The snippet above works properly. Is it also possible to predefine an email content (body)?
Raghu Kona
Hi, Currently, I cant find the key values for body or attachment fields. May be we can see more information in the next update Tizen 2.1 expected in a couple of weeks, before the Tizen Web Conference. But, you can do the same using the Tizen Messaging API. Regards, Raghu Kona
Check privileges for sms sending
Email*