on 2007 Dec 04 1:05 AM
Hi,
i have this problem as i new in adobe. and i wish to know if i want to attach an offline interactive forms to email and send it out..
do anyone have this sample code..
for me i now create the FileUpload and also join with Email Sending code in WDP.
then below is my code
<b>wdThis.wdGetUploadEMailController().wdGetContext().currentContextElement().getPdfSource();
wdThis.wdFirePlugToPDF();</b>
i wonder is it correct??
as my mindset is now bind the pdf for fileupload to the PdfSource then when i click on the send email it will attach as an attachment then send it out.
so is this method correct?
Hi Jia Jun Ng,
First u hav to Paste that offline interactive form to src -> mimes -> Components -> U r package Folder ... Later do the following code.
Properties props = new Properties();
String host = "162.146.1.51"; // U R Mail Server ID
props.put("mail.smtp.host", host);
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(session);
Address toAddress = new InternetAddress();
Address fromAddress = new InternetAddress();
Address ccAddress = new InternetAddress();
Address bccAddress = new InternetAddress();
try
{
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
fromAddress = new InternetAddress("abc@yahoo.com"); // From Address
message.setFrom(fromAddress);
toAddress = new InternetAddress("xyz@gmail.com"); // To Address
message.setRecipient(Message.RecipientType.TO, toAddress);
message.setSubject("Sample Mail");
messageBodyPart.setText("Hi,This is sample mail");
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
String filename = "temp
webdynpro
web
local
<Web Dynpro Project Name>
Components
< Component Package Name >
< PDF Name >";
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(source.getName());
messageBodyPart.setHeader("Content-Type","application/pdf");
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
wdComponentAPI.getMessageManager().reportSuccess("Mail Delivered Successfully ....");
}
catch (AddressException e)
{
wdComponentAPI.getMessageManager().reportWarning(e.getLocalizedMessage());
e.printStackTrace();
}
catch (SendFailedException e)
{
wdComponentAPI.getMessageManager().reportWarning(e.getLocalizedMessage());
e.printStackTrace();
}
catch (MessagingException e)
{
wdComponentAPI.getMessageManager().reportWarning(e.getLocalizedMessage());
e.printStackTrace();
}
It will send the offline Interactive Form to tht Mail Id u hav Specified.
With Regards,
Roop Kumar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roop Kumar,
thanks for your reply but for me, i have that code also but then my current situation is like i want the user to upload the offline form. that mean i allow the user to use the fileupload UI after which the user click send email button.. the code where u stated <b>"String filename = "temp
webdynpro
web
local
<Web Dynpro Project Name>
Components
< Component Package Name >
< PDF Name >";"</b> will get it from the Fileupload the pdf. then attach the pdf then send as attachment to the user.
that mean the user can dynamic upload the offline fill interactive form to his/her boss.
as the code you provided me is more toward static..
Regards
Ng Jia Jun
User | Count |
---|---|
69 | |
13 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.