on 03-21-2007 1:18 PM
Hi All,
How can I send mail through WebDynpro application that includes an HTML content?
Thanks,
Aviad
Hi Aviad,
Personally I'd use the <a href="http://jakarta.apache.org/commons/email/">Commons Email</a> API. I don't know if SAP also provides a nice API.
Kind regards,
Sigiswald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aviad,
Please use this ldocument link to send emails,
Regards,
Ramganesan K.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the following for sending attachments :
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(Attachment);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(Attachment);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(Attachment);
multipart.addBodyPart(messageBodyPart);
msg.setContent(multipart);
Regards, Anilkumar
That's exactly what Commons Email makes easy Check the topic "Sending HTML formatted email" in the <a href="http://jakarta.apache.org/commons/email/userguide.html">User guide</a>.
It should be straightforward to use from within Web Dynpro. Store the necessary jar file(s) in an External Library DC. Another option is always to copy/paste (parts of) the source code, but that seems a bit of an ugly approach.
Kind regards,
Sigiswald
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.