<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to write Python or JSL to automatically log in to an email account to send and receive emails? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928661#M108589</link>
    <description>&lt;P&gt;I cannot directly help you, but you can use VScript to send mail with JMP, use Mail() command, powershell with Send-MailMessage or other options.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Feb 2026 10:10:53 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2026-02-03T10:10:53Z</dc:date>
    <item>
      <title>How to write Python or JSL to automatically log in to an email account to send and receive emails?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928554#M108581</link>
      <description>&lt;P&gt;Thanks Experts!&lt;/P&gt;
&lt;P&gt;Directly read the current JMP table:&lt;/P&gt;
&lt;P&gt;Row 1 contains the sender email information&lt;/P&gt;
&lt;P&gt;Row 2 contains the receiver email information&lt;/P&gt;
&lt;P&gt;After receiving the email, directly write the received content into row 2 of the “Content” column in the current table.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table(
    "EmailConfig",
    Add Rows(2),
    New Column("Email", Character, Set Values({
        "A@gmail.com",
        "B@gmail.com"
    })),
    New Column("Password", Character, Set Values({
        "AA",
        "BB"
    })),
    New Column("Content", Character, Set Values({
        "Test",
        ""
    }))
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Feb 2026 03:21:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928554#M108581</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2026-02-03T03:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to write Python or JSL to automatically log in to an email account to send and receive emails?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928575#M108583</link>
      <description>&lt;P&gt;For Python, this isn't correct place to ask.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For JSL, what type of service do you have? Do you have access to some API to send and receive the emails which JMP can access?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Feb 2026 05:33:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928575#M108583</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-02-03T05:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to write Python or JSL to automatically log in to an email account to send and receive emails?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928626#M108586</link>
      <description>&lt;P&gt;Thanks Experts!&lt;BR /&gt;AI's&lt;BR /&gt;it's not work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

sender = Char(dt:Email[1]);
pwd_sender = Char(dt:Password[1]);
content = Char(dt:Content[1]);
receiver = Char(dt:Email[2]);
pwd_receiver = Char(dt:Password[2]);

proxy = "--proxy \!"http://127.0.0.1:7897\!"";

message_file = "C:\temp\jmp_message.txt";
Save Text File(message_file, "Subject: Test Email\n\n" || content);

send_options = {"smtp://smtp.gmail.com:587", "--mail-from", sender, "--mail-rcpt", receiver, "--user", sender || ":" || pwd_sender, "-T", message_file, "--ssl-reqd", proxy};

rp_send = Run Program(
	Executable("curl.exe"),
	Options(send_options),
	ReadFunction(Function({this}, send_out = this &amp;lt;&amp;lt; Read; Show(send_out); ))
);

Wait(10);

search_options = {"--url", "imaps://imap.gmail.com/INBOX", "--user", receiver || ":" || pwd_receiver, "-X", "\!"SEARCH ALL\!"", proxy};

rp_search = Run Program(
	Executable("curl.exe"),
	Options(search_options),
	ReadFunction(Function({this}, search_out = this &amp;lt;&amp;lt; Read; ))
);

match_pos = Contains(search_out, "* SEARCH");
if(match_pos &amp;gt; 0,
	ids_start = match_pos + Length("* SEARCH ");
	ids_end = Contains(search_out, "\r\n", ids_start);
	ids = Substr(search_out, ids_start, ids_end - ids_start);
,
	ids = "";
);

id_list = Words(ids, " ");
if(N Items(id_list) &amp;gt; 0,
	last_id = id_list[N Items(id_list)];
,
	last_id = "";
	dt:Content[2] = "Receive Failed";
	throw();
);

fetch_options = {"--url", "imaps://imap.gmail.com/INBOX", "--user", receiver || ":" || pwd_receiver, "-X", "\!"FETCH " || last_id || " BODY.PEEK[TEXT]\!"", proxy};

rp_fetch = Run Program(
	Executable("curl.exe"),
	Options(fetch_options),
	ReadFunction(Function({this}, fetch_out = this &amp;lt;&amp;lt; Read; ))
);

body_start = Contains(fetch_out, "{");
body_end = Contains(fetch_out, ")", body_start);
body_length = Num(Substr(fetch_out, body_start + 1, body_end - body_start - 1));
content_start = body_end + 2;
received_content = Substr(fetch_out, content_start, body_length);

cleaned = Trim(Regex(received_content, "[\\r\\n]+", " ", "GLOBALREPLACE"));

dt:Content[2] = cleaned;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Feb 2026 08:20:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928626#M108586</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2026-02-03T08:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to write Python or JSL to automatically log in to an email account to send and receive emails?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928661#M108589</link>
      <description>&lt;P&gt;I cannot directly help you, but you can use VScript to send mail with JMP, use Mail() command, powershell with Send-MailMessage or other options.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Feb 2026 10:10:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-Python-or-JSL-to-automatically-log-in-to-an-email/m-p/928661#M108589</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-02-03T10:10:53Z</dc:date>
    </item>
  </channel>
</rss>

