Skip to Content
author's profile photo
Former Member

Sending Email from Web Dynpro

Hi,

I'am new in that business and have a simple question:

What is the easiest way to send emails from a web dynpro application to a specific (e.g. value of an input field in my application).

The only way I found was the "email - web service tutorial in the pdk).

Can anyone give me some code to solve this problem.

Thanx

christoph

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • Best Answer
    author's profile photo
    Former Member
    Aug 09, 2005 at 08:22 AM

    hi,

    How abt this .

    InitialContext ctx = new InitialContext();

    Properties props = new Properties();

    props.put("mail.smtp.host","msg server");

    Session sess = Session.getInstance(props);

    //Create new mime message object

    Message message = new MimeMessage(sess);

    message.setFrom(new InternetAddress(from email));

    String recepient = wdContext.currentContextElement().getTo();

    message.setRecipient(Message.RecipientType.TO,new InternetAddress(to email));

    message.setSubject(subject);

    message.setContent(content,"text/plain");

    //Send the message

    Transport.send(message);

    Regards

    Bharathwaj

    Message was edited by: Bharathwaj R,Error corrected.Check my next post also!

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Sorry ! One sec! I will edit it and do it again !

      InitialContext ctx = new InitialContext();

      Properties props = new Properties();

      props.put("mail.smtp.host","Message server");

      Session sess = Session.getInstance(props);

      //Create new mime message object

      Message message = new MimeMessage(sess);

      message.setFrom(new InternetAddress(wdContext.currentContextElement().getFrom()));

      String recepient = wdContext.currentContextElement().getTo();

      message.setRecipient(Message.RecipientType.TO, new InternetAddress(recepient));

      String subject = wdContext.currentContextElement().getSubject();

      message.setSubject(subject);

      String content = wdContext.currentContextElement().getMessage();

      message.setContent(content,"text/plain");

      //Send the message

      Transport.send(message);

      This should work.. (Some editing error while i was pasting it !)

      Message was edited by: Bharathwaj R

  • Aug 09, 2005 at 07:33 AM

    Hello,

    is it not really good for you https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/web dynpro tutorial and sample applications.faq#q-6 ?

    Regards, Maksim R.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Aug 09, 2005 at 07:35 AM

    Hi,

    Easiest way is

    1.Create Link to URL

    2.create a contextarrtib "reference" and set the reference and text property of linktoURL to this attribute.

    3.use this statement in the init method.

    wdContext.currentContextElement().setReference("mailto:<EMailID>");

    Regards, Anilkumar

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 09, 2005 at 07:44 AM

    hi,

    there are number of options available, like you can use the java mail framework to create your own mail service and you can use that, or if you have your own mail service configured (like outlook webaccess) you use that too.

    regards,

    rahul.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Aug 09, 2005 at 07:48 AM

    Hi Christoph,

    Check out this weblog:

    /people/renald.wittwer/blog/2005/01/05/develop-a-web-service-that-sends-an-email

    Regards,

    Pooja.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Aug 09, 2005 at 09:12 AM

    Hi,

    Syntax is

    InternetAddress[] Toaddress = new InternetAddress[Number];

    msg.setRecipients(MimeMessage.RecipientType.TO, Toaddress);

    Regards, Anilkumar

    Add comment
    10|10000 characters needed characters exceeded