Subscribe Bookmark RSS Feed

JSL mail function

wei

Community Trekker

Joined:

Sep 22, 2015

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

8 REPLIES
ron_horne

Super User

Joined:

Jun 23, 2011

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

Joined:

Jul 28, 2015

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

Community Trekker

Joined:

Sep 22, 2015

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

Joined:

Jun 23, 2011

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

Community Trekker

Joined:

Sep 22, 2015

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

Joined:

Jul 28, 2015

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

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

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."))

);

jcampbell

Community Member

Joined:

Jun 3, 2015

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"
)
);