Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

javamail webapplication  RSS feed

Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
my requirement is i want javamail application is only for sending the particular given recepent id in tomcat by using smtp i m trying can u pls anybody help me finding the solution for my problem r else send me any code for my reqirement . this is my mail id
i tried like this
import javax.mail.Address;
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;

public class Mail{
public Mail(){}
String frommail="";
String tomail = request.getParameter("tomail");
String sub = request.getParameter("sub");
String textarea = request.getParameter("textarea");
boolean multipart = true;
String smtphost = "";
public static void main(String args[])

public void sendMail(String smtp_host, String from, String to, String subject, String message) throws AddressException, MessagingException
Message msg = prepareHeader(smtp_host, from, to, subject);
msg.setContent(message, "text/plain");
Transport transport = session.getTransport("smtp");
transport.connect(smtp_host, null, null);
transport.sendMessage(msg, msg.getAllRecipients());
}catch(AddressException ae)
catch(MessagingException me)

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!