Using JSL to send emailsI'm trying to use JSL to send emails as part of a data retrieval query. How do I embed a data table or Journal table into the body of my text message?
Thanks
Re: Using JSL to send emailsHi @dadawasozo ,
Not that I'm aware of, I believe you can only add it as an attachment, not within the body of the email. I think it can only handle text in the email.
DS
Re: Using JSL to send emailsHi DS,
Is it possible to to send picture in the email body (not attachment) and at the same time attach a table? The Eval () and get text not working for picture
Re: Using JSL to send emailsNot that I'm aware of.Re: Using JSL to send emailshi. Thank you for your quick response.
But, I would like to ask again, could there be a possibility that I could attach the photo to the mail's body? Thank you in advance.
Re: Using JSL to send emailsHi @lalala ,
Not sure if there is a way to do it with the commands that were listed previously in this thread. The text is just tab-delimited and you can edit it in the email. I am not aware of any commands to modify this when sending the table as text
However, there is a possible workaround that might suit your needs. You have to get the data table report as a picture, save it, and then send it as an attachment. It will look like the data table format in JMP report windows.
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
dt = Data Table( "Big Class" );
path="your path\"; //be sure to have the last backslash included in this.
tb=dt<<GET as="" report=""></GET>
You can of course save the picture in different formats than png.
The attachment will look like this:

Not ideal, but the data will be formatted and aligned as desired. It won't be editable or copy/pastable like the text email version. Perhaps you can put in a request to JMP to have them provide more options for the Get Text() command so it can provide more complex formatting options?
Hope this helps!,
DS
Re: Using JSL to send emailsHi. is there a way the alignment per column be fixed? or if i could change the default font style used in this HTML email, cause it seems that the column is not align due to the letters in the default font style(arial) used takes different space per letter(like "I" has different space than "M"). so is there a way to change the font style or any other suggestion how to fix the alignment per column. thank you.
Re: Using JSL to send emailsGlad to hear that you figured out the mail client issue. Odd that it should be so dependent on that, but so are carriage returns. Glad it's now working for you.
DSRe: Using JSL to send emailsHi, it was indeed the email client. I uninstalled Mailbird and used Outlook and worked fine...
Thank you for your help!
Re: Using JSL to send emailsHi, this is the print screen...I think the issue might be the fact that I am not using Outlook as the email client, I am using Mailbird. Will try to configure Outlook and update

Re: Using JSL to send emailsHi @Stefan ,
That is really strange. I'm running JMP Pro 15.2.1 on W10 64-bit. This functionality is certainly not Pro dependent, so I can't imagine that's the case. When I run that code for the Big Class, I get this email out:

Did you copy/paste the code exactly, with only changing the email address? If the code was changed other than the email address, this could impact the formatting in the email. Do you have a screen shot of the code and email you receive from JMP?
DS
Re: Using JSL to send emails@SDF1 thanks for the quick reply, tried the few options you are recommending, no joy still. I am running on Windows, JMP 15.2.1
This is the excerpt from the email body...
The data is name age sex height weight...
Re: Using JSL to send emailsHi @Stefan ,
Using the "escape sequences", as they're called, can sometimes be a bit tricky. Sometimes they work as one would think they should, but other times they need to be invoked differently. It's kind of like :Column vs Column(dt, #), or As Column(). They all reference columns, but there are some cases where one is better than another.
Anyway, you were wanting a specific example for the carriage return, here is one that works with a built in data table in JMP.
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
dt = Data Table( "Big Class" );
tb=dt<<GET as="" report=""></GET>
You don't have to have the extra concatenate || in there between "The data is " and !\n. You can instead write it as "The data is !\n" || Eval() and it'll work just the same. But, however you implement it, the !\n must be in quotations: "\!n" for it to be read correctly.
One note that might be the reason you're having problems is the host operating system. If you're working in OS vs Windows, then the carriage return is different: CR vs CR LF, respectively. If you're on a Mac, the "\!n" won't work. Instead, you should use "\!N" with a capital N. When you use that, it insert a line break appropriate for the host operating system.
Hope this helps!,
DS
Re: Using JSL to send emailsHi, how did you manage to add the carriage return, I've tried all options with \!n, but no success. Can you add an example please?
Cheers!
Re: Using JSL to send emailsYou're welcome. I also found out that if you include a \!n within quotations after your "opening sentence", you can have a carriage return before the data table is printed in the email.Re: Using JSL to send emailsHi DS,
Thank you very much!! This is what I needed! I appreciate your help.
Lou
Re: Using JSL to send emailsHi @lou,
This was a great challenge, and I think I figured it out. Should be only about three lines of code.
Names Default To Here( 1 );
dt = Data Table( "My Data Table" ); //this defines whichever data table you're dealing with
tb=dt<<GET as="" report=""></GET>
I tested it on a data table of mine and it worked great. It even puts the text in a data table style/format. It is just text, but this should solve the original problem.
UPDATE: I went back and tested if you could add more text to the body and you can if you wrap the <
Hope this helps!,
DS
Re: Using JSL to send emailsHi DS,
Thanks for your reply. Attaching is an alternative. Still looking for a way to add this to the main message, whether by table, journal or picture.
Lou
Re: Using JSL to send emailsHi @lou,
I did a search for Mail in the Scripting Index and found this:
Names Default To Here( 1 );
Mail( "test@example.com", "revelation", "JMP is great.", "$SAMPLE_DATA/Big Class.jmp" );
I tested it out with the Alarm Script example and it send me a message. I did not attach any JMP file, and not sure if it will embedd in the email body, but it will at least offer to add an attachment. Should solve your problem.
Hope this helps!,
DS