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

Adobe AIR Development

Reply
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
Accepted Solution

How can i send mail from my application to a given email id using adobe AIR?

[ Edited ]

           Hi,

 

            can anyone tell me how can i send mail from my app?

 

                 var variables:URLVariables = new URLVariables();
                variables.to = emailTxt.text;
                variables.subject = emailsubTxt.text;
                variables.message = msgtext.text;
                
                // the request object containing URL and parameters
                var request:URLRequest = new URLRequest("http://www.gmail.com/mail.php");
                request.method = URLRequestMethod.POST;
                request.data = variables;
                trace("request.data"+request.data);
                
                // now send a request to the PHP script with those parameters
                var urlLoader:URLLoader = new URLLoader();
                urlLoader.addEventListener(Event.COMPLETE, responseReceived);
                urlLoader.load(request);
                
                function responseReceived(event:Event):void
                {
                    urlLoader.removeEventListener(Event.COMPLETE, responseReceived);
                    trace('E-mail sent!');
                }
                    

i am using above code ,but its not working..

 

one more question,is it possible to send that mail from simulator as well?

 

reply me plz..........

 

thanks n advance.

d.dev
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: How can i send mail from my application to a given email id using adobe AIR?

You cannot send mail directly from an app. You can use the "mailto" tag to open up a browser to send mail. On BB10, you could invoke the email client to an email. You can set up some services on your server to send mail via your SMTP server.

In your sample above, there is not a way via a URL to login into the gMail account.
Please use plain text.
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000

Re: How can i send mail from my application to a given email id using adobe AIR?

can i get any idea how to setup  some services on my server to send mail via my SMTP server?does it require PHP script or anything like that?

d.dev
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: How can i send mail from my application to a given email id using adobe AIR?

If you have PHP and a SMTP mail server on your system, PHP has a mail() function. Other languages have similar features. You just have to write the handful of lines to accept the parameters and send it along. There is lots of information on the web to set this up. Not knowing what kind of server and hosting you have, you may already have it on your system.
Please use plain text.
Trusted Contributor
nikmaster
Posts: 116
Registered: ‎11-10-2012
My Device: BB Playbook

Re: How can i send mail from my application to a given email id using adobe AIR?

I had an app like that. All you need is a php script on your server side. You have to parce some data via POST request. All information should be included in that request. You may set ANY senders email :smileyhappy:

http://php.net/manual/en/function.mail.php

 



Please click the Thumbs Up icon if this comment has helped you! If your issue is resolved, please click the solution button on the resolution!


Please use plain text.
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000

Re: How can i send mail from my application to a given email id using adobe AIR?

[ Edited ]

THANKS....

d.dev
Please use plain text.