on 04-11-2006 6:18 AM
HI all,
any one knows how to send email from webdynpro application. Please reply.
Thank you
Maruthi
Maruti,
You can send rich-text as well as plain text emails they JavaMail API.
Please refer the below code as an example for sending Messages:- Sending an email message involves getting a session, creating and filling a message, and sending it. You can specify your SMTP server by setting the mail.smtp.host property for the Properties object passed when getting the Session:
String host = ...;
String from = ...;
String to = ...;
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject("Hello JavaMail");
message.setText("Welcome to JavaMail");
// Send message
Transport.send(message);
You should place the code in a try-catch block, as setting up the message and sending it can throw exceptions.
Also check the below links for further details:-
http://java.sun.com/products/javamail/FAQ.html
http://java.sun.com/developer/onlineTraining/JavaMail/contents.html
<b>- Chintan Virani</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Refer this link
is this the one you are looking for
Regards,
RK
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.