Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 18
Registered: ‎12-20-2010
My Device: bold
My Carrier: webmaster
Accepted Solution

sending email in a widget

Hi,

 

I was wondering how to send emails in a web app ?

I've tried this code :

 

function send_mel(){

var args = new blackberry.invoke.MessageArguments('foo@domain.com', 'hello', 'world');
args.view = blackberry.invoke.MessageArguments.VIEW_NEW; // New
blackberry.invoke.invoke(blackberry.invoke.APP_MESSAGES, args);

}

 

and in my config.xml :

 

<feature id="blackberry.message" required="true" version="1.0.0"/>
<feature id="blackberry.identity" required="true" version="1.0.0"/>
<feature id="blackberry.find" required="true" version="1.0.0"/>
<feature id="blackberry.invoke.MessageArguments" required="true" version="1.0.0.0"/>

 

when I launch the function (testing in the simulator 5.0.0.972) I get this message :

 

erreur.jpg

 

So what's wrong with this code ?

 

Thanks for the response.

 

Michel

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: sending email in a widget

You almost have it Smiley Happy

 

You need to add the following feature element to alow the invoke feature to work:

 

 

  <feature id="blackberry.invoke" required="true" version="1.0.0.0"/>

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: sending email in a widget

Also, if you just want to send an email without popping up the email application.. you can do so with the following api:

 

http://www.blackberry.com/developers/docs/widgetapi/blackberry.message.Message.html

 

 

<script type="text/javascript">
  var message = new blackberry.message.Message();
  message.toRecipients = "noone@blackberry.com";
  message.subject = "Hello";
  message.body = "World";
  message.send();
</script>

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 18
Registered: ‎12-20-2010
My Device: bold
My Carrier: webmaster

Re: sending email in a widget

thanks a lot, this helped me a lot :-)

Highlighted
Regular Contributor
Posts: 56
Registered: ‎08-21-2012
My Device: BB10
My Carrier: RIM

Re: sending email in a widget

Hi,

I'm trying the same but getting Exception: 'undefined' is not a constructor. Am I missing something? I'm installing this in Blackberry-10's beta4 simulator and the webworks SDK version is 1.0.3.8.