on 09-15-2005 2:44 PM
Hi all,
I wan't to send an email from webdynpro with an attached pdf-document. I had a look at Tutorial 31, but i will only use the first part, sending email with attached interactive form. So I decided to build a new project. I did everything as in the tutorial described, but when entering the following code into the wdDoInit method from the SendView an error occurs.
//@@begin wdDoInit()
// @TODO Enter your email address for the setFrom and setTo methods by replacing the text in angle brackets.
wdContext.currentEmailElement().setFrom("name@company.com");
wdContext.currentEmailElement().setTo("name@company.com");
wdContext.currentEmailElement().setCc("");
wdContext.currentEmailElement().setBcc("");
wdContext.currentEmailElement().setSubject("Travel Request Form");
wdContext.currentEmailElement().setBody("BlaBlaBla");
//@@end
In the coding is no error. In the Context node of the SendView I created a new value node with the value attributes. When writing the code and using strg+space i can complete automatically, so no writing errors.
When deploying and running the application I get always a NullPointerException, if make no difference if i delete one entry or which line of code i insert, the same error.
java.lang.NullPointerException
at com.ao.test.emailtest.SendView.wdDoInit(SendView.java:99)
at com.ao.test.emailtest.wdp.InternalSendView.wdDoInit(InternalSendView.java:127)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
I've compared my project with the one from tutorial but i found no differences.
Have anybody have an idea what to do?
Thanks
Mathias
Hi,
NullpOinter excepttion could be bcose of "currentEmailElement()".
Please create an element of EmailNode before these statements.
IPrivate<ViewName>.IEmailElement ele=wdContext.createEmailElement();
wdContext.NodeEmail().addElement(ele);
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
Message was edited by: Anilkumar Vippagunta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
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.