Topic
  • 15 replies
  • Latest Post - ‏2019-05-24T07:51:38Z by PaulBrett
RT123
RT123
28 Posts

Pinned topic WTX email adapter for sending attachments

‏2019-05-21T10:00:29Z |

Hi All,

 

Can you please help me with a sample map which uses the ITX/WTX email adapter to send email with multiple files as an attachment. I am using ITX v 9.0.0.3

What is best approach? And also how to send the attachment, as single files attached or a one zip file?

Note: The number of attachments are not fixed, we can have any number of attachments.

 

 

Thanks,

 

Updated on 2019-05-21T11:08:34Z at 2019-05-21T11:08:34Z by RT123
  • PaulBrett
    PaulBrett
    368 Posts
    ACCEPTED ANSWER

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T07:47:48Z  

    Assuming you have all the attachments in a single directory (with no other files) you could use the Batch adapter to get a list of the files.

    Using this list you could design a map that would create a single ZIP file, containing those files.

    Finally, you could read this attachment in, convert to BASE64, and attach it as part of a MIME encoded message to be sent using SMTP to an email relay server.

    See the attached example for these three steps.

    Thank you.

    Paul

    Follow me on Twitter

    Attachments

  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T07:47:48Z  

    Assuming you have all the attachments in a single directory (with no other files) you could use the Batch adapter to get a list of the files.

    Using this list you could design a map that would create a single ZIP file, containing those files.

    Finally, you could read this attachment in, convert to BASE64, and attach it as part of a MIME encoded message to be sent using SMTP to an email relay server.

    See the attached example for these three steps.

    Thank you.

    Paul

    Follow me on Twitter

    Attachments

  • RT123
    RT123
    28 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T08:28:08Z  
    • PaulBrett
    • ‏2019-05-23T07:47:48Z

    Assuming you have all the attachments in a single directory (with no other files) you could use the Batch adapter to get a list of the files.

    Using this list you could design a map that would create a single ZIP file, containing those files.

    Finally, you could read this attachment in, convert to BASE64, and attach it as part of a MIME encoded message to be sent using SMTP to an email relay server.

    See the attached example for these three steps.

    Thank you.

    Paul

    Follow me on Twitter

    Hi Paul,

     

    Thank you for the map file. But while I run the EmailAtt map i get the error source not available, the Archive.zip file isn't generated while I run the ZipFiles map though it completes successfully. Can you please check what configuration I could have missed.

     

    Thanks

  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T08:38:20Z  

    You have to run the maps in order:

    GetList.mmc
    ZipFiles.mmc
    EmailAtt.mmc

    ....so that the Archive.zip exists before the final map attempts to email it.

    Thank you.

    Paul

    Follow me on Twitter

  • RT123
    RT123
    28 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T08:41:36Z  

    Yes Paul, I run the maps the below order:

    GetList.mmc

    ZipFiles.mmc 

    EmailAtt.mmc.

     

    ZipFiles.mmc doesnt generate the Archive.zip file after running. Thats why the last map fails with source not available. Please check.

    Can you check at your end too. Thanks.

  • RT123
    RT123
    28 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T08:45:33Z  
    • RT123
    • ‏2019-05-23T08:41:36Z

    Yes Paul, I run the maps the below order:

    GetList.mmc

    ZipFiles.mmc 

    EmailAtt.mmc.

     

    ZipFiles.mmc doesnt generate the Archive.zip file after running. Thats why the last map fails with source not available. Please check.

    Can you check at your end too. Thanks.

    I am also attaching the ListOfFiles.txt file generated after my first map: GetList.mmc is run. Kindly check.

    Attachments

  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T08:47:21Z  

    There's a small mistake in the EmailAtt.mmc map.  Change rule from:

    ="ITX E-Mail Adapter 1.0.0.0.0.0.0"

    to

    ="IBM Transformation Extender Email Adapter 1.0.0.0.0.0.0"

    ....although I would like to point out that this map will never actually run, until you amend some of the details, such as changing it to point to your own SMTP server.

    Thank you.

    Paul

    Follow me on Twitter

  • RT123
    RT123
    28 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T08:52:01Z  
    • PaulBrett
    • ‏2019-05-23T08:47:21Z

    There's a small mistake in the EmailAtt.mmc map.  Change rule from:

    ="ITX E-Mail Adapter 1.0.0.0.0.0.0"

    to

    ="IBM Transformation Extender Email Adapter 1.0.0.0.0.0.0"

    ....although I would like to point out that this map will never actually run, until you amend some of the details, such as changing it to point to your own SMTP server.

    Thank you.

    Paul

    Follow me on Twitter

    Yes have changed the rule as you have corrected it, but the issue here is Archive.zip file itself isn't created. Is  there some setting or configuration to be done for the zip file to be created. Also i am pointing my SMTP server to mine.

     

    Thanks,

     

     

     

  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T09:11:10Z  

    What is the output of the GetList map?

    Change rule :

    =PUT("ZIP","FILE,Archive,"+PACKAGE(In1),"dummy")

    to

    =PUT("ZIP","FILE,Archive,"+PACKAGE(In1),"dummy") + LASTERRORMSG()       (and change the target of the output card from SINK to FILE)

    ...to get more information about what could be going wrong with ZIP file creation.

    Thank you.

    Paul

    Follow me on Twitter

    Updated on 2019-05-23T09:11:48Z at 2019-05-23T09:11:48Z by PaulBrett
  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T09:16:49Z  

    Change rule:

    =PUT("ZIP","FILE,Archive,"+PACKAGE(In1),"dummy")+LASTERRORMSG()

    to

    =PUT("ZIP","FILE,"+GETDIRECTORY()+"Archive,"+PACKAGE(In1),"dummy")+LASTERRORMSG()

    ....to avoid problems with running the map in Map Designer.     (Archive.zip was being created in product installation directory)

    Thank you.

    Paul

    Follow me on Twitter

    Updated on 2019-05-23T09:17:44Z at 2019-05-23T09:17:44Z by PaulBrett
  • RT123
    RT123
    28 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T09:39:56Z  
    • PaulBrett
    • ‏2019-05-23T09:16:49Z

    Change rule:

    =PUT("ZIP","FILE,Archive,"+PACKAGE(In1),"dummy")+LASTERRORMSG()

    to

    =PUT("ZIP","FILE,"+GETDIRECTORY()+"Archive,"+PACKAGE(In1),"dummy")+LASTERRORMSG()

    ....to avoid problems with running the map in Map Designer.     (Archive.zip was being created in product installation directory)

    Thank you.

    Paul

    Follow me on Twitter

    Thank you Paul. This time it creates the Archive file without .zip extension. I am attaching the Archive generated form the the map putput of ZipFiles.mmc.  Again since the .zip extension sin't there the final map fails with source not available error.

    Attachments

  • RT123
    RT123
    28 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T10:00:24Z  
    • RT123
    • ‏2019-05-23T09:39:56Z

    Thank you Paul. This time it creates the Archive file without .zip extension. I am attaching the Archive generated form the the map putput of ZipFiles.mmc.  Again since the .zip extension sin't there the final map fails with source not available error.

    Now it works, now i changed the command to =PUT("ZIP","FILE,"+GETDIRECTORY()+"Archive.zip ,"+PACKAGE(In1),"dummy")+LASTERRORMSG() and it works.

     

    Another query, i have is now I wish to read form another folder in my windows desktop folder, how should be modified something like below will work?

     

    @echo off
    cd /d %~dp0
    dir /b C:/Users/RT123/Desktop/SamplePics

  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T10:07:05Z  

    Another copy of the maps, with adjustments made.

    Thank you.

    Paul

    Follow me on Twitter

    Attachments

  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T10:07:17Z  
    • RT123
    • ‏2019-05-23T10:00:24Z

    Now it works, now i changed the command to =PUT("ZIP","FILE,"+GETDIRECTORY()+"Archive.zip ,"+PACKAGE(In1),"dummy")+LASTERRORMSG() and it works.

     

    Another query, i have is now I wish to read form another folder in my windows desktop folder, how should be modified something like below will work?

     

    @echo off
    cd /d %~dp0
    dir /b C:/Users/RT123/Desktop/SamplePics

    Yes

    Thank you.

    Paul

    Follow me on Twitter

  • RT123
    RT123
    28 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-23T10:41:00Z  
    • RT123
    • ‏2019-05-23T10:00:24Z

    Now it works, now i changed the command to =PUT("ZIP","FILE,"+GETDIRECTORY()+"Archive.zip ,"+PACKAGE(In1),"dummy")+LASTERRORMSG() and it works.

     

    Another query, i have is now I wish to read form another folder in my windows desktop folder, how should be modified something like below will work?

     

    @echo off
    cd /d %~dp0
    dir /b C:/Users/RT123/Desktop/SamplePics

    Hi Paul,

     

    Seems my issues aren't resolving. In your example the files are already placed within the /tmp folder which is within the ITX workspace. I want to read the files from another directory C:/Users/RT123/Desktop/SamplePics.

    @echo off
    cd /d %~dp0
    dir /b C:/Users/RT123/Desktop/SamplePics

    The command above reads the file names but not its content and also cannot copy the contents form the other directory and create a zipfile out of it. My Archive.zip file is blank.

    I guess some changes in functional map can help achieve.

     

    Please suggest.

     

    Thanks

     

  • PaulBrett
    PaulBrett
    368 Posts

    Re: WTX email adapter for sending attachments

    ‏2019-05-24T07:51:38Z  

    Yes, the batch script needs to be altered to include the full path in the list, and the map needs to be altered to NOT add the map path at the start of each entry.

    Thank you.

    Paul

    Follow me on Twitter

    Attachments