Sending mail from JSP through Microsoft Outlook

Hi all,
i want to send an e-mail from JSP by clicking on link or button through Microsoft's Outlook..
Can anyone guide me..

something like this,
          try{
               props = new Properties();
               props.load(this.getClass().getClassLoader().getResourceAsStream("contact.properties"));
               int i=0;
               String referer = props.getProperty("contact.allow.referer."+i);
               email = props.getProperty("report.email.error");
               while(referer != null){
                    i++;
                    contact.put(referer, "true");
                    referer = props.getProperty("contact.allow.referer."+i);
          }catch(Exception e){
               e.printStackTrace();
          try{
               Session session = (Session)new InitialContext().lookup(this.props.getProperty("reports.jndi.email"));
               SMTPMessage m = new SMTPMessage(session);
               m.setFrom(InternetAddress.parse(this.props.getProperty("report.email.from"))[0]);
               m.setRecipient(RecipientType.TO, new InternetAddress(this.email));
               m.setSubject(this.getSub());
               StringBuffer msg = new StringBuffer();
               msg.append("Employee Name: "+fn + " " + ln +"\n");
               msg.append("Employee ID: "+this.getId()+"\n");
               msg.append("Message: "+this.getMsg()+"\n");
               m.setText(msg.toString());
               m.setReplyTo(InternetAddress.parse("no-reply"));
               m.saveChanges();
               Transport trans = session.getTransport();
               trans.send(m);
               trans.close();
          }catch(Exception e){
               e.printStackTrace();
          }          contact.properties:
reports.jndi.email=java:comp/env/globalMail
report.generation.timeout=3000
report.email.subject=Some Subject
[email protected]
[email protected]

Similar Messages

  • Error in sending mail from SAP to microsoft outlook

    Hi all.
    Greetings.
    I have a requirement to send mail from SAP to Outlook.
    SMTP is configured here....i have checked the steps.
    I am using FM "SO_NEW_DOCUMENT_SEND_API1" to send the mail text.
    when i check the SOST Tcode i got message "Wait for communications service".
    after evry 10 minutes the sap connect all process runs..as it is configured in SCOT transaction, but even after 30 minutes the mail is not sent.
    I don't know how should i check the error message?
    tell me the checking stepls plz?...how should i step through in checking this?
    what are the prerequsites for sending mails from SAP to Microsoft outlook?
    regards
    Prashant Tiwari
    Edited by: prashant tiwari on Feb 6, 2009 10:26 AM

    Hi prashant,
    Pls refer to the link below:
    Re: Inbound Email- SAP Connect
    or
    check your userid .
    If not correct  no mail will go from u r id.
    Try it with another user id.
    or try using the following function module
    'SO_NEW_DOCUMENT_ATT_SEND_API1'
    I Hope this helps you with the issue.
    Thanks
    Ravi Aswani

  • Need to Send Mail from JSP...

    Dear Team,
    I Need to Send Mail from JSP, have Designed user Interface to enter
    to, from, subject, and message text .
    Have Downloaded mail.jar and activate.jar file..... and placed in tomcat lib directory and WEBAPPS/WEB-INF/lib Directory too
    How do i send a mail to user ?
    do I require something else apart from things that i have mentioned?
    do i have to Configure SMTP, POP3 or Something like this....
    Now If I Create a object of Type MimeMessage and Set Recipient, from, subject and if i say transport.send(message) will this do My JOB???

    Dear Team,
    I Need to Send Mail from JSP, have Designed user
    Interface to enter
    to, from, subject, and message text .
    Have Downloaded mail.jar and activate.jar file.....
    and placed in tomcat lib directory and
    d WEBAPPS/WEB-INF/lib Directory too
    How do i send a mail to user ?
    do I require something else apart from things that i
    have mentioned?
    do i have to Configure SMTP, POP3 or Something like
    this....
    Now If I Create a object of Type MimeMessage and Set
    Recipient, from, subject and if i say
    transport.send(message) will this do My JOB???Yup! in addition to all the above i need to know my mail box outgoing mail server. and that's enough...... i am able to do that.
    Regards,
    Jagadeesh HS.

  • Sending Mail from jsp

    Hi guys,
    can anyone help me out of this problem ??
    I have written a piece of code which sends mail from a jsp page.
    When I use the 'Recipient'(TO) as an address in the same domain
    (ie,<xxx>@<apeejaygroup.com>) it works fine.
    But when I use an address such as <xxx>@<rediffmail.com>
    the code gives an error like -
    "javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 5.7.1 ... Relaying denied"
    I am sending the piece of code for reference..
    String host ="192.168.33.11";
    String from="[email protected]";
    String to="<xxx>@apeejaygroup.com";
    ( HERE USING THE ADDRESS AS <xxx>@<rediffmail>.com
    GIVES THE EXCEPTION - javax.mail.SendFailedException: 550 5.7.1 ... Relaying denied )
    Properties props = System.getProperties();
    props.put("mail.smtp.host", host);
    javax.mail.Session session1 = javax.mail.Session.getDefaultInstance
    (props, null);
    MimeMessage message = new MimeMessage(session1);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
    message.setSubject("Your Registration Details");
    message.setContent(body,"text/html");
    Transport.send(message);
    Please help me out of this.
    Regards
    Satrajit

    as you said that it might require authentication
    but our mail server doesn't require authentication to mail.
    Now what should i do ??Many servers are now authenticating by requiring you to fetch your e-mail before sending. This is basically because most SMTP mail servers CAN NOT authenticate in the normal sense of the word. So, they use the fetch process for authentication. The fetch process already requires authentication normally. Then your IP address will be good for, say, 20 minutes, and you can relay e-mail through the server.
    It works with most E-mail clients such as Outlook or Netscape, because the default behavior is to 1.Connect to the POP server, 2.Login, 3.Download any new mail, 4.Connect to the SMTP server, 5.Upload any mail to send.
    Even if you don't have any mail, your IP address will at least have been authenticated. Even if you just check for mail, and not download any, you should be OK.
    So what I'd suggest is that you write some code that attempts to connect to your mail system's POP server, get authenticated successfully, then try sending out the e-mail through the SMTP server.

  • How to send mail from jsp

    hi,
    i want to send mail from my jsp page.
    1) how can i do this
    2) do i need any mail server for doin this
    thanks
    regards
    manoj

    i want to send mail from my jsp page.
    1) how can i do this
    2) do i need any mail server for doin thisRead
    http://java.sun.com/developer/onlineTraining/JavaMail/
    Rather,
    try this:
    http://jakarta.apache.org/taglibs/doc/mailer-doc/mailer-1.1/index.html

  • Sending mail from sap Inbox to outlook

    Hi All,
    Iam new to SAP workflow. Here I need to send the mail from SAP Inbox to Outlook for high priority keeping red flag as icon.
    can anyone tell me how to set up this and go ahead to start.
    Thanks
    Kumar

    IF I understand you correctly, you want to send a mail to Outlook (external email address) as a step in Workflow.
    If you are on Release 6.20 or above the following solution will work. I do not remember what is available in earlier releases.
    1) Define a multiline element based on SOXNA-FULLNAME to hold the email addresses. How you populate this element with the addresses depends on your requirements.
    2) Insert a Send Mail step in the workflow.
    3) In the Mail Tab, Select 'U' as Recipient Type.
    Assign the Multi Line element defined in Step 1 to E-Mail Address.
    4) Define the Subject and the body as needed.
    Please note that you should have External mail sending from SAP enabled and a batch job that runs periodically to push the mail.
    Cheers,
    Ramki Maley.

  • Sending Mail from JSP-Servlet

    hi all,
    Can any one help me, how can i send the mail from JSP-Servlet.
    in Spring, we have a the following package to send mail,
    import org.springframework.mail.MailSender;
    import org.springframework.mail.SimpleMailMessage;
    import org.springframework.mail.javamail.JavaMailSenderImpl;
    Suggest me to solve the problem.
    Thanx in advance.
    Bala

    Hi balu,
    i already go thru that API. My problem is if i add any additional jar file for sending the mail from JSP or Servlets only. not in high technology.
    i mention spring as an example.
    so, kindly suggets me on that.
    Bala

  • Sending mail from JSP page

    HI Everyone,
    Please help me out in this. It is very urgent so not able search the same in this forum.
    I have a J2EE application. The view is in JSP. If i click a button from a JSP page, any mail client (Microsoft Outlook) has to open and current page need to be attached as html. THen user wish to send the mail to somebody...
    So my aim is to open a outlook and attache the current JSP page as html. PLease help me out !

    Instead of outlook, you can do it easily using SMTP

  • Sending mail from workflow inbox to outlook,when idoc error occurs

    Hi All,
    I tried to send a mail to outlook from workflow by giving the email address in the step mail, but it was not working.
    i am getting the workitem in the sap inbox so tried setting the automating forward which we can forward from the sap inbox to outlook.
    Searched in SDN , but my issue was not solved..
    Could you please help me out with this issue to get the mail from workflow to outlook inbox.
    Thanks,
    Praveena

    Hi Praveena,
    Please check if the necessary SCOT settings have been made in your system to send mails outside SAP box. Check with your basis team if the SMTP connection between external system (Outlook, Lotus, etc) has been maintained or not.
    Then check in t-code SOST if you are getting the mail here when sent from workflow.
    Hope this helps!
    Regards,
    Saumya

  • Sending mails from SAP inbox to Outlook

    Hi,
    I am able to send mails to the SAP user's inbox in the SAP workplace thru my abap program but i would like send it to their outlook mail box. I'm able to get mails if i configure outlook to receive emails from SAP mail box but i would like to do it vice versa. I got the user's SMTP address.how do i do it? Is there any configurations are necessary or anything to do with my exchange server? give me some valid sugesstions.

    Hi,
    Check this link
    http://www.sapdevelopment.co.uk/reporting/email/email_sapmail.htm
    http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm
    Thanks & Regards,
    Judith.

  • Sending mail from JSP page with attachment

    I have a requirement to send mail with attachment from my jsp pages, which should come to a particular mail box. Can any one help me by sending sample codes. Thankx in advance.

    hi,
    When request is posted you have to save file data from request to a file. you can not access the data using request.getParameter("file").

  • I cant send mail from my through mail

    I have an email account with virgin, brought it through and i recieve mail but i am not able to send mail, not sure why?

    Isn't mail.virgin.net the name of the Incoming Server -- the incoming server, which you say is working is set up at Mail Preferences/Accounts/Account Information as to name of the server, Username, and password, along with entries in Mail Preferences/Accounts/Advanced for Port select for the Incoming.
    However, if that is working for you, you must have it correct. For the Outgoing server, isn't the proper name for Virgin services smtp.virgin.net? In Mail Preferences/Accounts/Account Information, click on the arrows beside the name of the SMTP, and choose Edit Server List. Remove all, or all but one of any references to the smtp.virgin.net. Enter anew, or with the remaining server, click on the Advanced Tab there, and choose Use Custom Ports. Then enter the Custom Port to be Port 25, and set the Authentication to None, and have no entries in Username or Password. This is consistent with those specs I can online saying the SMTP does not require Authentication.
    Also click Use this server only. Now if the smtp.virgin.net server is online, it should work.
    Ernie

  • Send mail from JSP page

    Hello,
    can some one help me to send emails from a jsp page.
    and if possible the source code of jsp or java...
    Thanks !

    read this:
    http://www.jspinsider.com/tutorials/jsp/javamail/jspjavamail_1.view

  • Sending mails from SBWP to MS Outlook

    Hi,
    I'm trying to configure SMTP in my SAP system. I'm successful in getting notifications and alerts generated by a program into my inbox in SBWP. Can somebody please tell me how do I configure it to receive them into my email Inbox in Outlook? What are the changes should I make from the regular configuration. I followed the SAP Note: 455140 for configuring SMTP.
    Thanks in Advance,
    Rajesh Manoharan

    hi
    good
    go through this link hope this would help you to solve your problem
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c6456e89-0a01-0010-0189-a7961fe42034
    thanks
    mrutyun^

  • How to send mail from jsp pageq

    Pls help me with this topic
    Thanks alot

    Can you make it clearer. Pls give me a sample code if possible
    Thanks alot

Maybe you are looking for

  • I recently updated to Leopard, and now DVD Studio Pro 3 doesn't work.

    Hey, So I have a 1.8 GHz PowerPC G5 iMac (old skool, yes I know) and I reciently updated from my OS 10.3 to Leopard 10.5.6 (mostly because the internet would no longer work and I had to update or I couldn't get the latest browsers.) However, I just r

  • How to get a week number  for the year using oracle sql query?

    hi everyone, i have the requirement to find the week number for the calender.. so that week number should start with 01 when the year starts and it should end with week end date(that is first saturday of the january month).. so next week number start

  • I photo cannot open because of problem

    this is the message i get when rying to open i photo on my macbook pro how can this be resolved apple suggests purchasing newest version of iphoto?

  • Find all instances in footage

    Is  there a way you can search for an instance of something in footage?  We  have footage of a photoshoot that I'm trying sync with the acutaly  stills.  I was hoping to figure out a quick way to place a marker on the  timeline for every strobe/flash

  • Premiere Pro CC 2014 RAM issues, audio dropouts and export failures

    So I've upgraded to PP CC 2014, it worked fine for a while. Then I've noticed that while editing audio starts to dropout (I'm getting PP system message in the low right corner). I tried to dig up some info on the subject, but the only explanation I s