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 redModerator: commented with the word RED - need an email address and ip address of the smtp server.
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.
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)
Lua (*.lp *.op)
Perl CGI (*.cgi, *.ipl, *.pl)
Python via Django (*.py)
Ruby, e.g. Ruby on Rails (*.rb, *.rbw)
Progress WebSpeed (*.r,*.w)