1 2 Previous Next 19 Replies Latest reply on Nov 8, 2016 10:31 PM by jameshoty

    Send Mail script step with attachment not working

    jameshoty

      I am trying to email to all the contacts (from a local FM solution) and attach a photo (stored locally) but the email is sent without the JPG file.

       

      Screen Shot 2016-11-01 at 11.49.49 PM.png

       

      Screen Shot 2016-11-01 at 11.52.32 PM.png

       

      The Family Trip 2014.JPG is located at Documents folder.

        • 1. Re: Send Mail script step with attachment not working
          AndrewCohn

          You may want to try using the Get(DocumentsPath) function to set the file path to a variable.

          • 2. Re: Send Mail script step with attachment not working
            jameshoty

            Check you please help check if the steps are correct?

             

            Screen Shot 2016-11-02 at 12.17.22 AM.png

            • 3. Re: Send Mail script step with attachment not working
              AndrewCohn

              Are you doing this on Mac or PC? You might want to try using a Case() statement in conjunction with the Get(SystemPlatform) function (1 = Mac, 2 = PC) to evaluate if you are doing this work on a Mac or PC, and then append "filemac:" or "filewin:" accordingly in the front of your file path, instead of the "file:" which, by "relative path" Filemaker means (I think) relative to the location of the database on the machine, so you might be getting the path wrong depending on where you have the database stored.

               

              Also, it might be helpful for debugging to watch the values of your variables when they are set by using the Script Debugger and the Data Viewer when you run the script.

              • 4. Re: Send Mail script step with attachment not working
                erolst

                This looks OK; but note that you can check this yourself quite easily.

                 

                If the Send Mail step is set to work "With dialog: On", it will open a new mail in your client using the provided text(s) and attachment, but not send it; so you can inspect it at your leisure to fine-tune the step parameters (and simply discard that unsent mail).

                 

                btw, there is no need to declare a global $$variable in your script if you won't be using that variable after the script has finished. Better use a local $variable to keep things tidy.

                • 5. Re: Send Mail script step with attachment not working
                  erolst

                  In my experience, "Send Mail" attaches files just fine without adding any "file:" prefix, at least on the Mac (which seems to be what James is using).

                   

                  @ James: Andrew's suggestion of using Script Debugger & Data Viewer is very sensible – if you have FileMaker Pro Advanced, that is. If you don't, and you still want to inspect the variable values, you can e.g. use the old school method of using dialog boxes to display them.

                  • 6. Re: Send Mail script step with attachment not working
                    philmodjunk

                    Is it possible that the original set up would have worked but your jpeg is a really massive file that is too large to email by normal means? There are file size limits after all--set not by Filemaker but by the email account and ISP's involved.

                     

                    I ask that because the original settings in the dialog should have worked provided that the file had the name shown and the file reference was correct. And simply using the add file option should guarantee that it is correct.

                    • 7. Re: Send Mail script step with attachment not working
                      jameshoty

                      I am doing this on Mac. And I have run debugger and also turned on the perform dialog. But if I just go down to the very basic, which is one script step, it still does not work.

                       

                      One script step, I mean I am viewing the record, there is a button called "Email" and this button has only the Send Mail script step and the attachment is on my local Mac, (documents or desktop folder).

                      • 8. Re: Send Mail script step with attachment not working
                        jameshoty

                        I have turned on the perform dialog and also try changing the attach file. Anyway, the attach files are about 100kb size.

                         

                        Screen Shot 2016-11-02 at 6.58.06 AM.png

                         

                        Screen Shot 2016-11-02 at 6.59.42 AM.png

                        • 9. Re: Send Mail script step with attachment not working
                          jameshoty

                          While replying to the above messages and doing the trial and error..... the send mail script step is working now. What was last performed was the changed of attach file and everything is resolved. Thank you all for your thought.

                           

                          My next task is to upload this to FMS and user can send mail but attach file come from their local. Hope I can do it...

                          • 10. Re: Send Mail script step with attachment not working
                            jameshoty

                            Oh..... the send mail script step is not working if I turned off perform without dialog (means I want to see the mail before actually sending it out), now that it is working, so I turn on the perform without dialog (automatically send without asking user interaction) and the attachment is not sent with the email.

                             

                            The script is entirely the same, the change is just whether to perform with or without dialog, and it affects the attachment being sent or not. Is this a bug somewhere? What should I do now?

                            • 11. Re: Send Mail script step with attachment not working
                              jameshoty

                              What I am referring to is:

                               

                              This WILL work (I can see the attachment before sending it out)

                              Screen Shot 2016-11-02 at 7.21.22 AM.png

                               

                               

                               

                              This WILL NOT work (email is sent automatically without user interaction)

                              Screen Shot 2016-11-02 at 7.24.28 AM.png

                               

                               

                              Sorry for the bad explanation previously and couldn't find the way to edit it, hence this additional reply

                              • 12. Re: Send Mail script step with attachment not working
                                jameshoty

                                I have hosted the same file onto FMS 14 and run the script (after modified to adjust to the server environment). I notice the same behavior and the email will be sent with the attach PNG file is the script is paused (i.e. perform with dialogue) and no attachment will the script run without user interaction.

                                 

                                I have also tested using FMPA version 13 and 14 to upload the solution to FMS 14 and the result is the same.

                                 

                                I repeat the above on another Mac running El Capitan and the result is the same. My current Mac is OS Sierra.

                                 

                                There is always no issue on iOS since it will prompt you to click send whether or not the script is perform with dialog.

                                 

                                I have also removed all my mail clients and recreat were th just one iCloud client on the Mac that is having El Capitan but to no avail.

                                 

                                Please help if you know someth about this problem.

                                • 13. Re: Send Mail script step with attachment not working
                                  jameshoty

                                  It is a "great" discovery (also disappointing) that it works perfectly fine when I execute it on my Windows computer. The client is FM Pro 13 running on Windows 7 (Parallel Desktop on my existing iMac). I created a mail client (@hotmail.com) and the email with attachment is sent to various recipient with different domain (meaning it can send to the recipients from gmail.com, me.com, hotmail.com etc).

                                   

                                  So I thought I should change my default mail client from @me.com to @hotmail.com on my iMac, but I am wrong again. No matter what mail client I am trying to use, the PNG is not attached with the mail.

                                   

                                  Is this a Mac Mail issue or FileMaker bug?

                                   

                                  I have another similar hosted solution (which I developed more than a year ago) that does the same email (with attachment) and it was working perfectly on this same iMac but it is not working now unless I run it from Windows PC.

                                  • 14. Re: Send Mail script step with attachment not working
                                    jameshoty

                                    Hi philmodjunk,

                                     

                                    Do you think you can help me with my issue as updated below?  What additional information should I submit that you think it will be helpful for this community?

                                    1 2 Previous Next