sending email jsp

Can some one please give me a sample mail jsp/bean !!!!!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This code sends mail using java mail

import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.FileDataSource;
import javax.activation.DataHandler;

// This method send a message
     public boolean sendJavaMail(String host, String from, String to,
String cc, String bcc, String subject, String message, String mimeType)
    Properties props = new Properties();
    props.put("", host);

    Session session = Session.getDefaultInstance(props, null);

      //Message msg = new MimeMessage(session);
      MimeMessage msg = new MimeMessage(session);

      InternetAddress from2 = new InternetAddress(from);

      InternetAddress[] to2 =  InternetAddress.parse(to);
      msg.setRecipients(Message.RecipientType.TO, to2);

      if(cc != null)
          InternetAddress[] cc2 =  InternetAddress.parse(cc);
          msg.setRecipients(Message.RecipientType.CC, cc2);

      if(bcc !=null)
          InternetAddress[] bcc2 =  InternetAddress.parse(bcc);
          msg.setRecipients(Message.RecipientType.BCC, bcc2);

      // Create subject

      // Create and fill the first message part
      MimeBodyPart mbp1 = new MimeBodyPart();
      mbp1.setContent(message, mimeType);

      // Create the Multipart and its parts to it
      Multipart mp = new MimeMultipart();

      // Add the Multipart to the message

               return true;
    catch (MessagingException ex)
               return false;

Good luck


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rax_uk2000Author Commented:
thanks that will do nicely !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.