This command is available for Office 365 users. OAuth authentication (OAuth2 protocol) is used to connect to the SMTP protocol and send emails.
In order to authenticate, you must provide the following elements:
- Microsoft Entra ID tenant ID: Tenant parameter
- Caller’s application client ID: ClientIdVal parameter
- Application’s secret value: ClientSecretVal parameter
Of course, this information will not appear in the Launcher trace.
For more information, here is a link to the Microsoft documentation.
Syntax
CHGVAR |
VAR(&CMD) VALUE('GRAPHSEND') |
CHGVAR |
VAR(&PARM1)
VALUE(' ;UserId="SMTP
user – email sender" ;ClientSecretVal="client secret" ;Tenant="tenant" ;Subject="subject" [;Text="Text of the email body"] [;Html="complete path of the HTML file, email body"] [;Attach="attachments list"] [;EmailCc="Recipients CC"] [;EmailBcc="Recipients BCC"] [;Priority=0|1|2] [;Importance=0|1|2] |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Parameters
Parameters |
|
Parm1 |
Server : SMTP
server name. Typically: outlook.office365.com. |
Parm2 |
UserId : SMTP account used for OAuth authentication and for sending email (FROM).
EmailTo : List of TO recipients. Each email address is separated by a semicolon.
ClientIdVal : Client ID. Useful for authentication.
ClientSecretVal : Client Secret. Useful for authentication.
Tenant : Tenant. Useful for authentication.
Subject : Subject of the email.
Text : Plain text of the email.
Html : Instead of using the Text parameter, you can specify here the full path to an HTML file that will correspond to the body of the email.
Attach : List of attachments. You must specify the full path for each attachment. Each path will be separated by a semicolon.
EmailCc : List of CC recipients. Each email address is separated by a semicolon.
EmailBcc : List of BCC recipients. Each email address is separated by a semicolon.
Priority : Email priority. 0
= not urgent
Importance : Importance of email. 0
= low |
Example
The following example sends an email with an HTML file in the body of the email, with attachments.
LNCCMD CMD(GRAPHSEND) +
PARM1('Server="outlook.office365.com";UserId+
="test@aura.com";Password="aura"+
;emailTo="contact@aura.com;+
tech@aura.com";clientIdVal="ddfgthyp-4444-5555-a+
fgt-asdftp74569b";clientSecretVal="TeV7U~rG+
5555.Y1hPmL9-HG7sC_OPMgbls8156zT";Tenant="4+
745etg9-sese-55e0-5479-5639874df156";Subjec+
t="Test GRAPH";Html="C:\A\ista4.HTML";+
Attach="C:\A\res.pdf;C:\A\F84.pdf;C:\A\image001.jp+
g;c:\A\image002.png"') +
PARM2('Priority=2;Importance=2')