cancel
Showing results for 
Search instead for 
Did you mean: 

sending a Email from the webdynpro application

Former Member
0 Kudos

Hi Guys,

I am having one requirement in my application .ie. Email to the specified Id .

As per my reqirement i am having 4 fields in my UI page.

Task Id : T001

Assigned to : ratnakar

Mail id : ratnakar.r.alwala@accenture.com

Task Description : Test Area

Submit : Save(Button)

when i click the Save button the Email has to reach the specified id with the task description.

could any body please help how to proceed .........

Thanks and Regards

Ratnakar reddy

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ratnakar,

Are you developing the Email functionality for a development component (DC) web dynpro?

If Yes, then u need to add the 'mail' in the used DCs. This can be done as:

1. Go to DC Metadata->DC definition->Used Dcs of ur project.

2. right Click on it and select add used DC

3. goto active part of the JDI

4. select 'mail' from the sap.com - SAP-JEE(i.e second sub tree)

5. after this u need to organize imports and select

import javax.mail.Message;

import javax.mail.MessagingException;

import javax.mail.Session;

import javax.mail.Transport;

import javax.mail.internet.AddressException;

import javax.mail.internet.InternetAddress;

import javax.mail.internet.MimeMessage;

if no, please ignore this

Regards,

Alka

Former Member
0 Kudos

Hi Alka ,

I am implementing the email in the webdynpro project ...i am not implementing in the DC's..

ProjectName -> webdynpro-> webdynproComponent ->CompApp-> view...

can any body help me to implement the email in the webdynpro project in detail..

Thanks and regards

Ratnakar reddy

Former Member
0 Kudos

Hi Ratnakar,

You need to add the "mail.jar" and "activation.jar" files to your project. Right click on your project -> Properties->Java Build Path - >Add External Jars -> now select the jar files that needs to be added.

Once the jar files are added to your proejct then all the errors will be resolved.

Refer to this thread to downlaod the jar files and code:

Regards,

Jhansi

Former Member
0 Kudos

Hi Janci,

thanks for your help and please give idea on the below statement

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

message server means ..do i need to give the server port number or name..

Thanks and Regards

Ratnakar

Former Member
0 Kudos

Hi Ratnakar,

Message server: Represents a messaging host.

This could be Hotmail, Yahoo, Excite, a private or corporate message server, or a peer able to send/recieve messages directly.

You must use your own mail server, or one provided by your Internet Service Provider or the company you work for. Your network administrator can give you the information necessary to configure JavaMail to work with your mail server.

You need to provide the second parameter inorder to send a mail.No need to change the first parameter.

Regards,

Jhansi

Former Member
0 Kudos

Hi Ratnakar,

Refer to the below thread which shows the code to send Email from Webdynpro application.

Regards,

Jhansi

Former Member
0 Kudos

Hi Guys,

Some body sugested me to use the javaMail api .. i donot exactly how to use it in the webdynpro application. some where i got the below code ...

InitialContext ctx = new InitialContext();

Properties props = new Properties();

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

Session sess = Session.getInstance(props);

Message message = new MimeMessage(sess);

message.setFrom(new InternetAddress(wdContext.currentContextElement().getFrom()));

String recepient = wdContext.currentContextElement().getTo();

message.setRecipient(Message.RecipientType.TO, new InternetAddress(recepient));

String subject = wdContext.currentContextElement().getSubject();

message.setSubject(subject);

String content = wdContext.currentContextElement().getMessage();

message.setContent(content,"text/plain");

// Send the message

Transport.send(message);

if i use the above same code i am not able resolve some errors with the session and internetAddress. becuse there are no supporting Imports to handle them even if used the Organise imports.

i am very new to this mailing concept can any body give me a step by step process ...to send the mail to the specified in the user interface.

Thanks and regards

Ratnakar

Former Member
0 Kudos

Use javamail for this.

Check https://forums.sdn.sap.com/click.jspa?searchID=1063990&messageID=1486766 or search on "javamail" in Webdynpro as well as java programming forums.

Regards, Anilkumar