cancel
Showing results for 
Search instead for 
Did you mean: 

Mailing Concept in WebDynPro.

Former Member
0 Kudos

Hi Friends,

Is it possible to implement Mailing Concept in WebDynPro?

If so how this can be done?

An e-mail has to be sent on click.

Please help me out in this regard.

Thanks and regards,

Chandrashekar.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hello,

You can use the below JAVA function for sending mail through a SMTP server.

import javax.mail.Address;

import javax.mail.Message;

import javax.mail.Session;

import javax.mail.Transport;

import javax.mail.internet.MimeMessage;

import javax.naming.InitialContext;

/**

  • To send a mail thru some smtp server

*/

public static void sendSMTPMail(Address addresses[], String subject, String content) {

InitialContext ctx = new InitialContext();

Transport mailTransport = null;

try {

Session sess = (Session) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/mail/MailSession"), Session.class);

Message msg = new MimeMessage(sess);

msg.setFrom(addresses[1]);

msg.setRecipient(Message.RecipientType.TO, addresses[0]);

msg.setSubject(subject);

msg.setContent(content, "text/html");

msg.setSentDate(new GregorianCalendar().getTime());

msg.saveChanges();

String SMTPIP = "SMTP_IP";

String SMTPPORT = "SMTP_PORT";

mailTransport = sess.getTransport("smtp");

mailTransport.connect(SMTPIP, SMTPPORT, "");

Address[] address = msg.getAllRecipients();

mailTransport.sendMessage(msg, address);

} catch(Exception smtpMailException){

throw new Exception(smtpMailException);

} finally {

if(mailTransport != null){

mailTransport.close();

}

}

}

Regards,

Smita

Former Member
0 Kudos
PradeepBondla
Active Contributor
0 Kudos

Hi,

Good blogs for the same

PradeeP

Former Member
0 Kudos
Former Member
0 Kudos
Former Member
0 Kudos

Hi,

Yes its possible there is no difference in Webdynpro

You have to use the Java mail API's

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0bf26e2-9bb3-2910-ea87-ee67a8ad...

Regards

Ayyapparaj