How to Send email using GMail SMTP server from jsp page? [closed]?

From JSP, when you submit the form, then you need to call a Java class in which you write code for sending mail using JavaMail. You can find an example here code.geekinterview.com/java/send-email-u... //set CLASSPATH=%CLASSPATH%;activation. Jar;mail.

Jar import javax.mail. *; import javax.mail.internet. *; import java.util.

*; public class Mail { String d_email = "iamdvr@gmail. Com", d_password = "****", d_host = "smtp.gmail. Com", d_port = "465", m_to = "[email protected]", m_subject = "Testing", m_text = " this is the testing email using smtp.gmail.com.

"; public static void main(String args) { String to={"XXX@yahoo. Com"}; String cc={"[email protected]"}; String bcc={"XXX@yahoo. Com"}; //This is for google Mail.

SendMail("[email protected]","password","smtp.gmail. Com","465","true", "true",true,"javax.net.ssl. SSLSocketFactory","false",to,cc,bcc, "hi baba don't send virus mails..","This is my style...of reply.. If you send virus mails.."); } public synchronized static boolean sendMail(String userName,String passWord,String host,String port,String starttls,String auth,boolean debug,String socketFactoryClass,String fallback,String to,String cc,String bcc,String subject,String text){ Properties props = new Properties(); //Properties props=System.getProperties(); props.

Put("mail.smtp. User", userName); props. Put("mail.smtp.

Host", host); if(!"". Equals(port)) props. Put("mail.smtp.

Port", port); if(!"". Equals(starttls)) props. Put("mail.smtp.starttls.

Enable",starttls); props. Put("mail.smtp. Auth", auth); if(debug){ props.

Put("mail.smtp. Debug", "true"); }else{ props. Put("mail.smtp.

Debug", "false"); } if(!"". Equals(port)) props. Put("mail.smtp.socketFactory.

Port", port); if(!"". Equals(socketFactoryClass)) props. Put("mail.smtp.socketFactory.

Class",socketFactoryClass); if(!"". Equals(fallback)) props. Put("mail.smtp.socketFactory.

Fallback", fallback); try { Session session = Session. GetDefaultInstance(props, null); session. SetDebug(debug); MimeMessage msg = new MimeMessage(session); msg.

SetText(text); msg. SetSubject(subject); msg. SetFrom(new InternetAddress("[email protected]")); for(int i=0;iTO, new InternetAddress(toi)); } for(int i=0;iCC, new InternetAddress(cci)); } for(int i=0;iBCC, new InternetAddress(bcci)); } msg.saveChanges(); Transport transport = session.

GetTransport("smtp"); transport. Connect(host, userName, passWord); transport. SendMessage(msg, msg.

GetAllRecipients()); transport.close(); return true; } catch (Exception mex) { mex.printStackTrace(); return false; } } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions