Is it possible to setup a SMTP server to send email through SMTP relay using JSL? See some options on SAS but not sure how to setup using JSL. Thank you
In my opinion this type of issues are generally easier to debug within windows commandline or powershell as those are generally issues there, not in JMP (sometimes there are though issues with quoting in JMP).
Bonjour,
Est-il possible en utilisant votre méthode de modifier le corps du mail (dans -Body)?
Par exemple pouvoir écrire un mail avec des retours à la ligne et des espaces ?
Exemple du mail :
Bonjour,
Voici les informations que vous recevrez :
- info1
- info2
Merci
Have you tried if it works? If I remember it should but you might have to build the body according to Powershell rules (for example https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_ru... ).
When I wrote functions to send email in JMP using Send-MailMessage, I did find using -BodyAsHtml easier than just -Body.
Merci pour vos réponses !
Pouvez-vous montrer un exemple svp ?
J’ai déjà essayé quelque chose comme ceci
Names Default To Here( 1 );
str = "\[$body = '
Attached to this email
You will find Instructions
'
Write-Output $body
]\";
RP = Run Program(
Executable("powershell.exe"),
Options({str}),
ReadFunction("text")
);
Existe-t-il la possibilité de le rajouter dans le script ci-dessous svp ?
Dans la partie « commandes » ?
Names Default To Here( 1 );
commands = {
"Send-MailMessage -From 'email@address' -To 'email@address' -Subject 'Test mail' -Body 'Message goes here' -SmtpServer smtp.server.com\!n",
"exit\!n"
};
icommand = 0;
RP = Run Program(
Executable( "PowerShell.exe" ),
ReadFunction( Function( {this}, Write( this << Read ) ) ),
WriteFunction(
Function( {this},
icommand++;
If( icommand <= N Items( commands ),
this << Write( commands[icommand] );
,
this << WriteEOF;
);
)
)
);
Names Default To Here( 1 );
str = "\[$body = '
Attached to this email
You will find Instructions
'
Send-MailMessage -From 'email@address' -To 'email@address' -Subject 'Test mail' -Body $body -SmtpServer smtp.server.com
]\";
RP = Run Program(
Executable("powershell.exe"),
Options({str}),
ReadFunction("text")
);
Super, merci pour votre réponse !
De la même façon, est-il possible de rajouter des caractères spéciaux dans le corps du mail ?
Send-Mailmessage has -Encoding parameter Send-MailMessage (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn which could work. Or maybe you need those here-strings or convert to html and manage them there.
Edit:
Names Default To Here( 1 );
str = "\[$body = @'
Use a quotation mark, like ' or ", to begin a string.
!\!"#$%&'()*+,-./:;<=>?@[\]^`{|}~‒–—―‘’‚‛“”„‟…
'@
Write-Output $body
]\";
RP = Run Program(
Executable("powershell.exe"),
Options({str}),
ReadFunction("text")
);
Merci pour votre réponse.
En parlant des caractères spéciaux, je parlais notamment des accents « é » ou « à ».