2 Replies Latest reply on Apr 30, 2013 12:54 PM by GregoryLypny

    Need Help with Send Mail Script

    GregoryLypny

      Title

      Need Help with Send Mail Script

      Post

           Hello everyone,

           I need help with my script for sending email.  The script loops through my found set, and uses a varable to create a file path that saves the current record in PDF.  The next script step sends an email with the PDF as an attachment.  The script then goes to the next record, and so on.  The script is shown in the image below.  The loop consists of just four steps:  (1) Set variable (the filename of the attachment); (2) Save Records as PDF; (3) Send Mail; and (4) Go to Next Record.  I should also note that because the script loops through the records in succession, the options I have chosen to create each email is "One email using data from the current record," and because each message is unique, I have not checked "Collect addresses across found set".

           Most of the time the script works as expected, but sometimes it sends the same message many times to the person whose record is the first one in the found set.  So, since I have 107 students in this database, the first student on occasion will receive their assignment report 107 times!  If this happens, I go to the print dialog under the File menu (Mac) and makes sure that "Records being browsed" is selected for the print choice, and actually save those records as a PDF.  I then go back to my script and run it.  This is an ad hoc fix, and I don't know what I am doing wrong.  Any tips would be most appreciated.  It's embarrassing sending someone so many emails.

           Gregory

            

      My_Send_Mail_Script.png

        • 1. Re: Need Help with Send Mail Script
          philmodjunk

               Given that it works some of the time, have you tried running a recover on this file? See if any issues are reported, then test the recovered copy for a bit even if no issues are reported to see if you still get the same issue.

               Things to keep in mind about Recover:

               While Recover almost always detects and fully corrects any problems with your file...

                 
          1.           The recovered copy may behave differently even if recover reports "no problems found".
          2.      
          3.           Recover does not detect all problems
          4.      
          5.           Recover doesn't always fix all problems correctly
          6.      
          7.           Best Practice is to never put a recovered copy back into regular use or development. Instead, replace the damaged file with an undamaged back up copy if this is at all possible. You may have to save a clone of the back up copy and import all data from your recovered copy to get a working copy with the most up to date information possible.

                

               And here's a knowledgebase article that you may find useful: What to do when your file is corrupt (KB5421).

          • 2. Re: Need Help with Send Mail Script
            GregoryLypny

                 Thank you for replying, PhilModJunk,

                 I never considered that the file might be corrupted.  I guess I could mess around with the Recover function, although wouldn't it be strange if the script was the only thing corrupted?