I have a script that sends emails to all records selected. Since that number can be 900+ emails, I would like to add a pause into the script after about 50-100 records/emails. Is this possible? Thanks.
I am assuming your script is running a loop and sending emails individually, in which case you can add in a variable that will increment each time you send an email, then check if that counter is at 50 for example, pause for a period of time and then reset the counter and go again
Something like this will do
Send Email [ ...
Set Variable [ $emailCount ; $emailCount + 1 ]
If [ $emailCount >= 50 ]
Pause [ 3600 ]
Set Variable [ $emailCount ; 0 ]
I hope this helps
Get the record number and apply a MOD on it.
If [ MOD ( Get ( RecordNumber ) ; 50 ) = 0 // equals 0 every 50 records) ]
Ok. So, I decided to send to multiple email addresses rather than multiple emails but still want to limit each email to 50 records. So, it looks like this:
Go to Related Record [ From table: “Student_course”; Using layout: “Student_course” (Student_course) ]
[ Show only related records ]
Set Variable [ $filename; Value:ValueListIDs ( "file:Student Lists/EMAIL PDF/" ) &Contacts::Last &Contacts::First &".xls" ]
Export Records [ File Name: “$filename”; Use field names as column names; Character Set: “Unicode (UTF-16)”; Field Order:
Student_course::Semester Course Completed
[ No dialog ]
Go to Layout [ original layout ]
Send Mail [ Send via E-mail Client; To: "tiffany.mulally@"; BCC: Contacts::Work Email & ";" &Contacts::Wilkes Email (collect
addresses); Subject: "Program Update"; Message: "Dear Students,"& "¶¶" &
"As many of you know, I am not just an employee of Wilkes University; I am a doctoral student as well. I’m writing today to let you
know that the education I have received here has allowed me to pursue a career opportunity that has been my dream. As a result,
I will no longer be serving as your program coordinator. I am leaving the University as a full-time employee as of Wednesday,
September 27, 2017. ¶¶
If you have questions or need assistance or advisement, please continue to use the following contacts, as you have been directed
through recent communication: ¶¶
It has been my pleasure and my joy to work with you throughout your tenure in our programs, and I wish you the very best as you
complete your graduate programming with Wilkes University. ¶¶
Would I put the MOD code before the Send Mail command?
Well, you've changed the loop from one email per address into many addresses in one email. I'm not quite sure what you've changed. I do a "gather" routine to split many emails into groups. This would then be a loop within a loop, so that you can send each group. How many are you grouping at one time?
The "Mod()" could certainly be used to make the groups (0, 1, 2, 3, 4, 5, etc. - depending on how many groups you have and/or how many in a group).
Sorry this is not a complete answer.
I was thinking 50 at a time, to make sure that emails don't kick back from the servers thinking it is spam...
I believe I usually limit to 25 at a time to prevent being a spammer. I also pause between the sends to help. How are you getting these emails for the BCC?
I work at a university and they are students in the program. I have created a database with the home emails they gave us and their school emails.
I meant how are you "grouping" the 50 at a time for a single email? That wasn't quite clear in your screenshot of the script. Or I mis-understood.
Goodness. I apologize. It is set up alphabetically so I was hoping to just go first 50 (or 25 as per your suggestion), next 50, etc. Will this not work?
Yes, but by script and or calculation l how are you isolating those 25/50 into a group value for the BCC? That's what I could not determine.
Sent from miPhone
I wasn't planning on separating them- that is why I was hoping a script would go through 25/50 records at a time. Maybe that isn't possible... I appreciate all of your help.
If you are looping the found set of records, the pause with the MOD() will work. But you then said that you will be "gathering" into groups of 25/50 to set in one email with BCC. That is an entirely different process.
How many records? Divide by the number you want to send at once. That is how many emails you will be sending correct? If so, that is how many groups you need.
Is the email body and all other information (from, subject, etc.) exactly the same for all? If so, then this is great.
What I may do (for some solutions) is to get all the unique emails into a variable. Then I use
to grab 1 thru x, x+1 thru 2x, etc. into other variables ($group1, $group2, etc.). My loop is then based on these groups to send the email with each group of "gathered emails". These groups are return-separated values, so you may need to
Substitute($group1; Char(13); ";") // or whatever your email client needs for multiple values
Keep in mind that at some point you may wish to use external means (plug-in) or send to mail service. Sending many emails (from FileMaker) is not something I do very often.
Retrieving data ...