cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
wei
wei
Level II

How to send mail to multiple e-mail addresses using JSL mail function

Hi There,

May I ask if possible to send mail in jsl to multiple email addresses?  What are the parameter use?

Thank you in advance.

 

Regards,

Sherwin

1 ACCEPTED SOLUTION

Accepted Solutions

Re: JSL mail function

Sorry to resurrect a potentially old post, but I had this problem today, and none of these solutions worked. Semicolons, "%3B", spaces, commas--all returned errors.

 

Here's what I did:

1. Make a list of recipients.

2. Use a for loop to cycle through the recipients, sending each an email.

 

Code example:

Recipients = {
"a@b.com",
"b@b.com",
"c@b.com",
};

For( i = 1, i <= N Items( Recipients ), i++,
Mail(
Recipients[i],
"Automatic email subject",
"Please fill in your TPS reports for the week .",
"C:\Fake Address\Fake TPS report.xlsx"
)
);

View solution in original post

10 REPLIES 10
ron_horne
Super User (Alumni)

Re: JSL mail function

hi Wei,

if you are using windows than you can send an email using JSL. the following is from the JMP scripting guide:

Mail

(Windows only) Mail sends an e-mail message to alert a user about a condition in JMP. For example,

a process control manager might include a test alert script in a control chart to trigger an e-mail

warning to her pager:

mail("JaneDoe@company.com", "out of control", "Process 12A out of control at "||Format(today(),

"d/m/y h:m:s"));

Mail can also send an attachment with the e-mail. An optional fourth argument specifies the

attachment. The attachment is transferred in binary format after its existence on the disk is

verified. For example, to attach the Big Class.jmp data table, submit

mail("JohnDoe@company.com", "Interesting Data Set", "Have a look at this class

data.", "C:\myJMPData\Big Class.jmp");

the following is from the help files:

Mail("host.id", "subject", "message", "attachment")

Description

(Windows only) Sends e-mail (using MAPI) to the host.id with the specified subject and message texts. Sends one or more attachments specified by the optional attachment parameter. The attachment argument can evaluate to a string or list of strings.

Examples

To send an email with multiple attachments:

Mail(

"yourname@company.com",

"New data and script",

"Today’s updated data table and script are attached.",

{"$DOCUMENTS/wd.jsl", "$DOCUMENTS/survey.jmp"}

);

or:

list = {"$DOCUMENTS/wd.jsl", "$DOCUMENTS/survey.jmp"};

Mail(

"yourname@company.com",

"New data and script",

"Today’s updated data table and script are attached.",

list

);

msharp
Super User (Alumni)

Re: JSL mail function

Just a word of caution, the mail function won't work if your JMP and email are running different bit versions.  For example a 64bit JMP and 32bit Outlook.  Unless they have finally found a fix for this I don't know about.

wei
wei
Level II

Re: JSL mail function

Thanks Ron and msharp for the replies.

I actually can send email with the above scripting guide to one email address only.  Is there any way I can add multiple email address in the first

argument?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: JSL mail function

Try to simply put multiple e-mailadresses separated by comma in one string. I tried that on the Mac – yes, the Mail() function is no longer Windows only – and it kind of works.


A Mail.app dialogue popped-up about the address (i.e. the csv-chain of addresses) not appearing to be a proper e-mail address but when I clicked "send anyway" they were all sent as expected.

Other Mail clients and Windows may behave differently.

wei
wei
Level II

Re: JSL mail function

Thanks MS...

Comma is not working for windows and the log shows "unable to resolve recipient name in address book".

I still need to figure out what is the right procedure.  It might be in windows setting.

msharp
Super User (Alumni)

Re: JSL mail function

Since your using windows I'm assuming you use Outlook.  Outlook deliminates email by ";" not by ",".

mikedriscoll
Level VI

Re: JSL mail function

good to know the other options. I've always used something like this from a button box...  Use "%20" instead of spaces. There's probably a better way but I don't use it often so it is good enough for me.

newwindow("example",

    ButtonBox("Report A Bug", web("mailto:xyz@domain.com;xyz1@domain.com?Subject=subject%20goes%20here&Body=Body%20goes%20here."))

);

Re: JSL mail function

Sorry to resurrect a potentially old post, but I had this problem today, and none of these solutions worked. Semicolons, "%3B", spaces, commas--all returned errors.

 

Here's what I did:

1. Make a list of recipients.

2. Use a for loop to cycle through the recipients, sending each an email.

 

Code example:

Recipients = {
"a@b.com",
"b@b.com",
"c@b.com",
};

For( i = 1, i <= N Items( Recipients ), i++,
Mail(
Recipients[i],
"Automatic email subject",
"Please fill in your TPS reports for the week .",
"C:\Fake Address\Fake TPS report.xlsx"
)
);

tsl
tsl
Level III

Re: JSL mail function

I also find that nothing works as an address delimiter, always get an error that email address is not correct.

 

Yes, the loop solution is the only one that works....however....each time Mail() is invoked, Outlook brings up a dialog which says "A program is trying to send an email message on your behalf. If this is unexpected,  click Deny and verify your antivirus software is up to date..."

 

It's tolerable to have to click "Allow" once in order to send the email but to have to do it multiple times for a loop becomes inelegant to say the least.

 

By the way, this pop-up also means it's impossible to have a scheduled / batch job  in JMP sending email since the email program forces acknowledgement of the attempt to send email. It could be this is because of my organization's information security policies.