IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Sending Email with Attachment

  • 1.  Sending Email with Attachment

    Posted Sun November 20, 2016 02:53 AM

    Hi Team,

    I need to send PDF file as attachment through email. I am able to send it using pub.cleant:SMTP service. However when I try to open that PDF file it gives error file is not decoded properly. I am passing htmlmailStream as input to the pub.cleant:SMTP. htmlmailStream is obtained from the output of pub.mime:getEnvelopeStream.

    Can you please suggest hot to resolve it.

    Thanks &Regards,
    NB


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Sending Email with Attachment

    Posted Mon November 21, 2016 02:33 AM

    Could you try passing it base64encoded and while receiving it base64decoded? Use the built in services for base64 encoding and decoding.

    Regards
    Senthil


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Sending Email with Attachment

    Posted Mon November 21, 2016 11:12 AM

    What is the content-type you are specifying in the smtp service under data/ or attachments and make sure it is application/PDF and also try with base64 encode/decode as Senthill suggested above.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: Sending Email with Attachment

    Posted Tue November 22, 2016 06:11 AM

    Hi Senthilkumar,

    Thanks for guidance.

    While sending, I will encode it. I am not clear about decoding. Once I received this pdf in email after that I do not want any thing to do. It should open as expected. This is our requirement. Can you please make me more clear on when should I decode the content.


    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: Sending Email with Attachment

    Posted Wed November 23, 2016 06:48 AM

    Hi,

    Please decode the encoded input ,pass that byte value to the content and use base 64 in encoding in attachments document in smtp service.

    emailAttachment.PNG


    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: Sending Email with Attachment

    Posted Wed November 23, 2016 02:44 PM

    Hi Sathyaraj

    Still, I am getting the same error. Below is the flow of my code.

    1. I invoked pub.mime:getEnvelopeStream service. It’s output is a stream.
    2. Converted this stream into bytes.
    3. encoded bytes into base64 using service pub.string:base64Encode. It’s output is a string.
    4. Here I am invoking service pub.client:smtp. In attachements\conten, I passed this encoded string, contentType set to application/pdf, file name set to test.pdf and encoding set to base64.

    Could you please let me know where I should try to decode it. I tried to decode it using 2-3 scenarios but still getting the same error.

    Thanks in advance…!!


    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: Sending Email with Attachment

    Posted Wed November 23, 2016 02:57 PM

    Hi,

    Please use the attached sample package which I got from the forum.

    Let us know if thats what you needed?

    Thanks,
    Sathya
    HTMLEmailWithAttachment.zip (6.91 KB)


    #webMethods
    #Integration-Server-and-ESB


  • 8.  RE: Sending Email with Attachment

    Posted Fri June 01, 2018 07:30 PM

    Hi NB,

    I am having the same issue as you had while opening the PDF.

    Could you please share how you resolved the issue?

    Regards,
    Irfan


    #Integration-Server-and-ESB
    #webMethods


  • 9.  RE: Sending Email with Attachment

    Posted Thu February 27, 2020 01:25 AM

    I am facing the same issue,Did you resolve this?


    #webMethods
    #Integration-Server-and-ESB