cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Email to proxy

Former Member
0 Kudos

HI all,

any one knows how to send email from webdynpro application. Please reply.

Thank you

Maruthi

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

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>

Former Member
0 Kudos

Hi Virani

Thank you for ur reply. It looks like ur document is very much helpfull.I havn't started coding.I'll start soon.I will award marks for ur reply.Just rermind me .I will do that after I have solved my prob

Regards

Maruti

Thank you

Former Member
0 Kudos

Answers (0)