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
Take a look at the 'Mail()' command.
Thank you for the reply. When I use Mail() function the email is sent through outlook client which blocks automatic email sending for me. I'm trying to use SMTP routing to avoid using outlook client. Is there a way to configure mail() function to use SMTP routing instead of Outlook client?
Understood. Maybe there is some help in this earlier thread.
If you are on windows here an option using powershell:
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; ); ) ) );
Info about the powershell utility:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.1
Note that this requires powershell version 2:
https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-the-windows-powershell-2.0-engine?view=powershell-7.1
Bonjour,Comment je peux faire pour rajouter une pièce-jointe dans le mail svp ?
You can with most likely with all the different methods. For PowerShell (which I most of the time use) see the Microsoft documentation.
J’ai essayé avec la fonction « -Attachment » en suivant le modèle de ce lien :
En indiquant le bon chemin d’accès, je ne reçois pas de mail. Je dois faire une mauvaise manipulation ou utiliser une mauvaise syntaxe.
avez-vous un exemple de script faisant appel à une pièce-jointe SVP ?
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 :
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_rules?view=powershell-7.4#here-strings ).
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