Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I am having trouble with a custom message body for each recipient.  The below script is only using the content of Email::body from the first record.  any ideas?  I would like to have a concatenated body field:

Email::body =  "Dear" & Email::first_name  & "..... the rest of the message".  

when doing a test email with 3 family members in my foundset. again, the loop only sets the body of the first record.  

 

 // First connect to the SMTP server and create the message.
 Set Variable [ $msgCreate =
     EmailConnectSMTP( "mail.example.com" ) and
     EmailCreate( Email::from ; Email::to ; Email::subject ) and
     EmailSetBody( GetAsCSS( Email::body ); "html" )
 ]
 Go To Record/Request [ First ]
 Loop
     Set Variable [ $setRecipients = EmailRecipients [ Email::to ] ]
     Set Variable [ $msgSend = EmailSend ]
     Go To Record/Request [ Next ; Exit After Last ]
 End Loop
 // We've sent the same message to all recipients. Now disconnect
 Set Variable [ $disconnect = EmailDisconnect ]

thanks in advance for any advice!

-Kevin

Edited by drrehak

Hi Kevin, it looks like you need to bring the 'Set Variable [ $msgCreate etc ]' within the Loop. Once you have sent the message with the Set Variable [ $msgSend = EmailSend ] line, the message has gone. Each extra iteration through the loop will fail, since you no longer have a message ready to send.

You need to create a new message for each recipient.

Hi Kevin,

You do need to bring in your create into the loop. You can call send multiple times on the same create statement. However, the way you have it set up now each email will have the same body as the first record because you only call set body once so the body of the email will persist through each iteration. You can either bring in the EmailSetBody call into your loop or leave it how it is and then put placeholders for the values you want to replace into the actual email body and then use the function EmailBodySubstitute in the loop to substitute the values in.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.