MessageBlock multiple recipients -- how to read from query

Help please!  I need to send an email to a list of recipients based on a query.  The intended recipients can change over time.  Therefore, I have created a list within the system so that emails can be added or removed at any time by users that have access to the list.

I want to be able to query this list and send an email to the values returned.  However, I am having an issue with using MessageBlock to do this.

It appears that to add recipients, they need to be added like this

AddRecipient("[email protected]","email1","TO");

AddRecipient("email2@gmail.com","email2","TO");

AddRecipient("[email protected]","email3","TO");

Therefore, I am not sure how to convert my query values to accomodate this.

I was hoping to be able to send one email with all the recipients included.

Or will I need to loop through a dataset and send a separate email to each recipient?

Any assistance would be greatly appreciated.  

Thank you!!

Parents
  • Hi Michele

    Are we talking about 10 emails or 10,000 emails?  You may need to consider how many people are on the list.

    But generally speaking you would send 1 email to X people.  If  you are doing that then please make sure you are sending the emails with the recipients as BCC NOT 'To' as you don't want to create a data breach.

    If your data is returned to in a query as you cycle through the rows returned then you can add each recipient to the BCC list.

  • Thank you!  I some how lost my previous response...therefore, I will try again.  :-)

  • We are talking about less than 10 emails.  These are all internal emails.  Some of the address appear to go to a parent company.  However, they are all within the organization.  They are not users of Sage CRM (ex.  Accounting, non Sales Executives)

    Although it would be ideal to send it all in one email, I could not figure out how to do it based on the documentation provided for the messageblock object.  It does not appear that addrecipient is a property of the object.  I found AddRecipient in a community post.  I could not find anything about it  in the documentation.  Am I looking at that correctly??  It looks like everything except the recipients are included here....

    https://help.sagecrm.com/on_premise/en/2021R2/Dev/Content/Developer/ASP%20Object%20Reference/CRMMessageBlock%20Object/AS_CRMMessageProperties.htm

    This email was originally included in workflow.  However, the sales manager wanted to be able to add or remove email addresses from the recipient list as needed.  Therefore the list was added to MyCRM instead of having him make his way to the correct place in workflow as this is an area that he would not normally modify.  I also find that many forget to reactivate the workflow!! :-)

    I would have left it in workflow if I could have figured out a way to use a query for the "TO" value when creating the email in workflow.  If you have an example of how to do that, I would greatly appreciate it.

    I ended up using a table level script and looping through the record set returned by the query from the list maintained in the MyCRM area.  However, I would rather send one email to all the recipients if you could point me to an example of how to do that.  Currently there are about six email addresses.  However, next month, there could be five or perhaps seven or more.  I did not know how to make this work in that case...

    AddRecipient("[email protected]","email1","TO");

    AddRecipient("email2@gmail.com","email2","TO");

    AddRecipient("[email protected]","email3","TO");

    etc..

    If there is additional documentation or examples on messageblock that would be helpful, I would greatly appreciate it.

    As alway, I greatly appreciate your assistance!

Reply
  • We are talking about less than 10 emails.  These are all internal emails.  Some of the address appear to go to a parent company.  However, they are all within the organization.  They are not users of Sage CRM (ex.  Accounting, non Sales Executives)

    Although it would be ideal to send it all in one email, I could not figure out how to do it based on the documentation provided for the messageblock object.  It does not appear that addrecipient is a property of the object.  I found AddRecipient in a community post.  I could not find anything about it  in the documentation.  Am I looking at that correctly??  It looks like everything except the recipients are included here....

    https://help.sagecrm.com/on_premise/en/2021R2/Dev/Content/Developer/ASP%20Object%20Reference/CRMMessageBlock%20Object/AS_CRMMessageProperties.htm

    This email was originally included in workflow.  However, the sales manager wanted to be able to add or remove email addresses from the recipient list as needed.  Therefore the list was added to MyCRM instead of having him make his way to the correct place in workflow as this is an area that he would not normally modify.  I also find that many forget to reactivate the workflow!! :-)

    I would have left it in workflow if I could have figured out a way to use a query for the "TO" value when creating the email in workflow.  If you have an example of how to do that, I would greatly appreciate it.

    I ended up using a table level script and looping through the record set returned by the query from the list maintained in the MyCRM area.  However, I would rather send one email to all the recipients if you could point me to an example of how to do that.  Currently there are about six email addresses.  However, next month, there could be five or perhaps seven or more.  I did not know how to make this work in that case...

    AddRecipient("[email protected]","email1","TO");

    AddRecipient("email2@gmail.com","email2","TO");

    AddRecipient("[email protected]","email3","TO");

    etc..

    If there is additional documentation or examples on messageblock that would be helpful, I would greatly appreciate it.

    As alway, I greatly appreciate your assistance!

Children
No Data