Skip to Content
avatar image
Former Member

How to send mail through WebDynpro Application

Hi All,

How can I send mail through WebDynpro application that includes an HTML content?

Thanks,

Aviad

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Mar 21, 2007 at 01:29 PM

    Hi Aviad,

    Personally I'd use the Commons" target="_blank">http://jakarta.apache.org/commons/email/">Commons Email API. I don't know if SAP also provides a nice API.

    Kind regards,

    Sigiswald

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 21, 2007 at 01:35 PM

    AVIAD RIVLIN ,

    import java.util.*;

    import javax.mail.*;

    import javax.mail.internet.*;

    import java.util.ResourceBundle;

    public boolean sendMessage(String fromID, String toID, String mailSubject,

    String mailBody) {

    // Write mail sending logic here

    ResourceBundle dbproperties = ResourceBundle.getBundle("mention the property file name");

    String from = fromID;

    String to = toID;

    String subject = mailSubject;

    String body = mailBody;

    String dbhost = dbproperties.getString("MailServer");

    String host = dbhost;

    // create some properties and get the default Session

    try {

    Properties props = new Properties();

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

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

    // create a message

    Message msg = new MimeMessage(session);

    msg.setFrom(new InternetAddress(from));

    InternetAddress[] address = { new InternetAddress(to) };

    msg.setRecipients(Message.RecipientType.TO, address);

    msg.setSubject(subject);

    msg.setSentDate(new Date());

    msg.setText(body);

    Transport.send(msg);

    // System.out.println("Mail has been sent");

    // if mail sent , return true, else return false

    return true;

    } catch (Exception mex) {

    System.out.println("Error " + mex);

    return false;

    }

    }// end of sendMail...

    }

    regards

    Anil Dichpally

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 23, 2007 at 01:35 PM

    Hi Aviad,

    Please use this ldocument link to send emails,

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cacb9a7d-0c01-0010-1281-be4962c9ab3e

    Regards,

    Ramganesan K.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 23, 2007 at 01:41 PM

    Hi,

    you can follow this link relating to email

    https://www.sdn.sap.com/irj/sdn/collaboration as it has been raised regarding same topic

    Regards

    Radhika Kuthiala

    P.S Do award points for encouragement:)

    Add comment
    10|10000 characters needed characters exceeded