Jump to content
Sign in to follow this  
Noél Dubau

SendMail with attachments

Recommended Posts

Hello

Is it possible in the various functions sendmail to

- send to many recipients

- send with many attachments ?

Thanks

Noël

Share this post


Link to post
Share on other sites

Hi Noël,

Quote

send to many recipients

You can do this by passing in a comma separated list for the "to" parameter for EmailCreate . You can also use EmailCCRecipients to CC recipients and/or EmailBCCRecipients to BCC recipients. 

Quote

send with many attachments

You can send multiple attachments by calling EmailAttachFile for every attachment that you want to attach.

Share this post


Link to post
Share on other sites

Oh !

I'm sorry to have disturbed but I was not precise enough !

My question was about the free scriptmaster plugin and not 360Works Email !

Thanks !

 

Share this post


Link to post
Share on other sites

Noel

depends on which function you are using but something like this...

 

// then the attachment(s)
if (attachmentPath) {
	fl = attachmentPath.tokenize('\n')
	fl.each{
		attachmentPart = new MimeBodyPart()
		attachmentPart.attachFile(it)
		mainMultipart.addBodyPart(attachmentPart) //content
	} //end each
}//end if

 

Share this post


Link to post
Share on other sites

Hello John

Thanks for your replay.

I want to use the Send Email Witha attachment (Send Email With Attachments ( from ; to ; subject ; body ; smtpHost ; attachmentPath ))

But  my knowledge is too weak to know how to modify the original script !

Moreover I will be able to use it only if the possibility exists to address it to several recipients.

Noël

Share this post


Link to post
Share on other sites

you need three extra variables, with a list of addresses to send to for TO: CC: and BCC:

then something like

to.tokenize('\n').each{
	msg.setRecipient(Message.RecipientType.TO, new InternetAddress(it))
} //end each
if (cc){
	copy = cc.tokenize('\n')
	copy.each{
		msg.addRecipient(Message.RecipientType.CC, new InternetAddress(it))
	}//end each
}//end if
if (bcc){
	copy = bcc.tokenize('\n')
	copy.each{
		msg.addRecipient(Message.RecipientType.BCC, new InternetAddress(it))
	}//end each
}//end if

 

Edited by john renfrew

Share this post


Link to post
Share on other sites

As I'm not pro can you precise me :

- the variable to already exists ; I have to create the two others cc and bcc ; so the script woud be

Send Email With Attachments ( from ; to ;cc ; bcc;  subject ; body ; smtpHost ; attachmentPath )

- and in each variable I pass a list of emails separated by carriage return  as
 

toto@somewher.com

mimi@labas.fr

...

thelast@myhome.org

- And then where must I insert your code

Thanks

Share this post


Link to post
Share on other sites

instead of this one line

 

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

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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