Need Help with Send Mail Script
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.