BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-13-2007, 05:40 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 29
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default <Newbie> Send a Mail

Please Login to Remove!

Hello,

I'm in a practical course(in german Praktikum) and there is my Project to write a Programm which will send a E-Mail to a Mailaccount(always the Same account).
There should be only a few EditFields to type some things from the costumer.

There are now some problems. The first I did never used Java before. (only Delphi and C++).

and the Second the JavaCode.
I tried to use the simple HelloWorld Project for my Project.
I use the JDE in version 4.2.1. Here my Code Part for trying to send a Mail.

Code:
package ProjectHello;
import java.lang.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.blackberry.api.mail.*;


class HelloScreen extends MainScreen

{
    
    public EditField T1= new EditField(); 
    public EditField T2= new EditField();
    public HelloScreen()
    {
        super();
        LabelField title = new LabelField("Hallo du welt");
        this.setTitle(title);
        this.add(T1); 
        this.add(T2);
    }
    
    public String MailBody;
    public Message mail = new Message();
    public Address test = Address("Jagge1988@yahoo.de","Praktikant Martin"); ;
    public boolean onClose()
    {
            mail.addRecipient(EMAIL_ADDR,test);//error: cannot resolve symbol
            mail.setSubject("blubb");
            MailBody = new String();
            MailBody = "blaaa " + T1.getText() + " blaaablubb " + T2.getText();
            mail.setContent(MailBody);   
            mail.setStatus(TX_SENDING ,TX_ERROR);//2times error: cannot resolve symbol//Don't know about That
            Dialog.alert(MailBody);
            System.exit(0);
            return true;            
    }    
}
Please help me.

Thx a lot.

MfG Martin
P.S.: Sry for the bad english i hope you understand it. If you can answer in German plz do it.

Last edited by GERMartin : 07-13-2007 at 06:10 AM.
Offline  
Old 07-13-2007, 06:15 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

That is how you can invoke the sending e-mail application for the blackberry. Your application is running in the background and when you send the e-mail you will get back to your application

Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES ,
new MessageArguments(MessageArguments.ARG_NEW, "address@address.com", "Email", "Body"));
Offline  
Old 07-13-2007, 06:31 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 29
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

ohh sry i have forgotten to say there is 2 other class to which create a "gui"
I've only said i get it from the Hello world and there ist a little "gui"

Do you mean with Mail the Subject of the mail (at this place "address@address.com", "Email", "Body")


edit:
ahh now its compiling
I import now net.rim.blackberryapi.invoke.*;

Thx a lot for your help. i Hope it will work. I must try it on a very old PC (633MHz , 128MB Ram)

Last edited by GERMartin : 07-13-2007 at 06:56 AM.
Offline  
Old 07-13-2007, 07:26 AM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 29
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great, it works, i hope it is good enough.

is there maybe an easy way to send a Mail without show this menu?
Offline  
Old 07-13-2007, 08:08 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i think it is the easiest way....one line and it is working...maybe there is a way to send an e-mail directly from your application...but i used what i post to you Good Luck
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.