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'm using the SM's SendEmailHTMLFormatted function to great effect, I'm enjoying just just having the single script step. However I can't work out how to have multiple recipients in the 'to' parameter. 

It says in the function description in SM: "Additional possibilities include sending to multiple recipients, SMTP authentication, multi-part emails, attachments, and much more." I've tried separate multiple email addresses with a semi colon and comma but no joy.

Any help appreciated.

Thanks

change/adapt the function?

if (to){
	sendto = to.tokenize('\n')

	sendto.each{
		msg.addRecipient(Message.RecipientType.TO, new InternetAddress(it))
	}//end each

}//end if

 

Edited by john renfrew

  • Author

Sorry to be vague but this is new to me. What language is that? Would it go in to the msg.setRecipient bit in the scriptmaster module editor?

 

Thanks

Its Groovy, the language that the plugin uses.

in the Send Email (HTML-Formatted) module

replace the line 

msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to))

with the code above, should work.

  • Author

That works! Thank you so much. Just one more thing though, is it possible to have the separator as a comma? I've tried to replace

'\n'

with "," or ',' but to no avail.

Does it only work when there is a line between each entry (as well as the comma)?

Thanks

 

Send it as a comma separated list, then the code would be. Works here. List is my preference.

sendto = to.tokenize(',')

What you are doing is turning the values you sent into an array (list) so you are then looping through that and for each one you are adding a :TO onto the msg.

  • Author

Perfect, thank you! I think my mistake was putting the semicolon after the:

}//end if

Which I'm guessing would be ignored because of the '//'.

Cheers

  • Author

For some reason I can't get it to send to multiple recipients via our exchange server as the SMTP Server. For single addresses it is fine. Using a 3rd party SMTP provider outside the building is fine for multiple recipients.

Any ideas?

Also, is it OK to use double quotations for 

sendto = to.tokenize(',')

i.e. to.tokenize(",")


Thanks

Makes no difference, except makes it easier to troubleshoot the end function as FMP will later escape any " characters to \", and the point about Groovy is that its about making it as easy as possible to write the code - which is also why no need to put ; at the end of a line, and why there are lots of Groovy methods which are much simpler to write than in Java

Your issue might be more to with Exchange than the code itself...

 

  • Author

Thanks John. That sounds about right. Will post what the exchange solution if that's where it's going wrong.

Ta

  • Author

Yup it was exchange, it didn't have a problem with multiple addresses but just external ones.

 

Ta

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.