drrehak Posted August 1, 2017 Posted August 1, 2017 I am using EmailRecipients () , and we have noticed that sometimes duplicate emails are being sent. I had one customer who said they received 10! any ideas? My script is: Set Variable [ $result ; Value:EmailConnectSMTP("smtp.gmail.com:465";"info@**********.com";"*********";"ssl=1") ] If [ $result ≠ 1 ] Show Custom Dialog [ Message: EmailLastError & ¶ & "Feedback emails failed! Password most likely wrong. Tell Doc."; Default Button: “OK”, Commit: “Yes” ] Go to Layout [ original layout ] Exit Script [ ] End If #send email to foundset Go to Record/Request/Page [ First ] Loop Set Variable [ $first ; Value:patients::first ] Set Variable [ $email; Value:patients::email ] Set Variable [ $subject; Value:$first & ", Happy Birthday from Colonial Family Eyecare!" ] Set Variable [ $msgCreate ; Value:EmailCreate( "info@************.com";patients::email ;$subject ) and EmailSetBody( $$body) Set Variable [ $setRecipients ; Value:EmailRecipients($email) ] Set Variable [ $sent; Value:EmailSend ] If [ $sent ≠ 1 ] Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ; Button 2: “Cancel” , Commit: “No” ] Else End If Go to Record/Request/Page [ Next; Exit after last ] End Loop Set Variable [ $disconnect ; Value:EmailDisconnect ] If [ $disconnect="ERROR" ] Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ] Exit Script [ ] End If
ryan360Works Posted August 1, 2017 Posted August 1, 2017 Hi drrehak, While I am not sure how a recipient could have received 10 of the same message, setting the recipient in the EmailCreate function call and then calling EmailRecipients with the same email address is somewhat redundant. I would think that the redundant call shouldn't send the email twice but it is the only thing I can see in your script that could potentially be causing the issue short of having multiple records for the same recipient in your found set. Comment out the Set Variable [ $setRecipients ; Value:EmailRecipients($email) ] script step and see if the issue persists.
Recommended Posts
This topic is 2923 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now