File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes email code in j2me application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "email code in j2me application" Watch "email code in j2me application" New topic
Author

email code in j2me application

Priyanka Gawada
Greenhorn

Joined: May 08, 2012
Posts: 12
This is the servlet code for send email from j2me application?
When I run the j2me user interface for this code, it shows me the println() given in the code, but email is not sent to the specific account.
Kindly check this code and tell me if something is wrong.\
Code marked in red Moderator: commented with the word RED - need an email address and ip address of the smtp server.


Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
I don't know about servlets. That's from Java EE. This may be the wrong section of the Java Ranch Message Boards to ask about server-side programming.

You can't run a servlet inside of Java ME because the classes, like java.net.*, don't exist in Java ME. The only resources you can find here, in this section of forum, is the types of connections that Java ME can make. But you also need a pop/smtp email server to connect to that actually sends the message and for that you need some advice from people who know java server or other types of servers.

Java ME just has the following packages:
java.io
javax.microedition.io

Plus whatever networking packages ship in MSA (jsr 248)...
JSR 82 Bluetooth,
205 Wireless Messaging,
172 Web Services,
180 SIP
-- maybe one of them has a network connection you can use??

Plus the brand-specific custom API extensions that cell phone makers (such a Nokia) include in their phones.
Priyanka Gawada
Greenhorn

Joined: May 08, 2012
Posts: 12
Thanks for the reply.
I got the code from the following site: http://developers.sun.com/mobility/midp/articles/socketRMI/
Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
Okay, so yes. Java ME can open a connection. The article you post says that you need somthing to pick up the connection, a Servlet perhaps (see Servlets forum for validation of the Servlet and latest standards) and, that's not all, you also need a web host or server -- A web host that supports Java EE/Servlets if you choose the Servlet option.


I have seen people ask about server-side scripting before, but I don't know enough about the server side of things to actually point people at the solution. Supposedly you wouldn't even need a servlet just something, anything, just so long as it can answer a connection call then act on it which means you might have better luck on one of the dedicated forms for one of the Server-side languages. (Some server-side scripts are more supported than others, PHP is a popular one for example.)

As Wikipedia says:
Some server-side scripting languages:

ASP (*.asp, *.aspx)
C via CGI (*.c, *.csp)
ColdFusion Markup Language (*.cfm)
Java via JavaServer Pages (*.jsp)
JavaScript using Server-side JavaScript (*.ssjs, *.js)
Lua (*.lp *.op)
Perl CGI (*.cgi, *.ipl, *.pl)
PHP (*.php)
Python via Django (*.py)
Ruby, e.g. Ruby on Rails (*.rb, *.rbw)
SMX (*.smx)
Lasso (*.lasso)
WebDNA (*.dna,*.tpl)
Progress WebSpeed (*.r,*.w)
Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
Oh apparently Nokia has an article including a reference to Mail4Me, see: Sending mail from applications in Java ME.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: email code in j2me application
 
Similar Threads
sending mail using servlet
JAVA SOCKET PROGRAMMING
Hi,I need to convert applet code to swing code
SMTP Connecting
simple socket programming