Skip to Content
author's profile photo Former Member
Former Member

Interactive Forms for Email Attachment

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?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 12:33 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.