Forum Discussion

Lance_101's avatar
Lance_101
Occasional Contributor
6 years ago
Solved

SendMail Not Working When Sending Multiple Attachments

Hello, we're having trouble using the builtin function SendMail when sending more than one attachment. It works fine if we simply call the function and pass in our arguments. But when we call the function from our wrapper function we get an error stating "The files you want to attach to the message do not exist". Our wrapper function takes the attachments as an array and iterates through the array to form a comma-separated list which is passed to SendMail along with the other six arguments. When a breakpoint is set at the point where we're calling SendMail the attachments argument correctly evaluates to the comma-separated quoted strings we're expecting (e.g., "F:\Documents\attachment_1.txt", "F:\Documents\attachment_2.txt") so we don't understand why we're getting the error.

7 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    JavaScript uses the backslash as an "escape" character.  So, it could be that it's seeing the filenames incorrectly due to the backslash characters not being properly parsed.

    • Lance_101's avatar
      Lance_101
      Occasional Contributor

      Thanks for the suggestion. I used the vbscript Replace function to replace \ with \\ but got the same result. Looking at the SmartBear documentation I ran across a section on using CDO that looks promising. I think I'll give that a try.

      • sonya_m's avatar
        sonya_m
        Icon for Alumni rankAlumni

        Thank you tristaanogre!

         

        Hi Lance_101 , did you find a solution for this? Please let us know if you still need help from the Community.