SMTP設定JSL を使用して SMTP リレー経由で電子メールを送信するように SMTP サーバーをセットアップすることはできますか?SAS のいくつかのオプションを参照してくださいが、JSL を使用してセットアップする方法がわかりません。ありがとう
Re:SMTP設定上記の例の文字列の末尾にこれを追加してみましたが、うまくいきました。
-Attachments 'C:/file.txt'
完全な例は次のようになります。
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 -Attachments 'C:/file.txt'\!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;
);
)
)
);Re:SMTP設定J'ai のエッセイは、« -Attachment » のモデルを使用して、次のように機能します。
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.1
En indiquant le bon chemin d'accès, je ne reçois pas de mail. J公正なモーベーズ操作を実行し、モーベーズ構文を使用します。
SVP の重要な課題をスクリプトの例として確認しますか?
Re:SMTP設定ほとんどの場合、さまざまな方法で実行できます。 PowerShell (私はほとんどの場合これを使用します) については、Microsoft のドキュメントを参照してください。
Re:SMTP設定ボンジュール、
コメント メール SVP に連絡してください。
Re:SMTP設定Windows を使用している場合は、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;
);
)
)
);PowerShell ユーティリティに関する情報:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.1
これには PowerShell バージョン 2 が必要であることに注意してください。
https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-the-windows-powershell-2.0-engine?view=powershell-7.1
Re:SMTP設定理解した。 もしかしたら何か助けがあるかもしれないこの前のスレッド。
Re:SMTP設定返信してくれてありがとう。Mail() 関数を使用すると、電子メールの自動送信がブロックされる Outlook クライアントを通じて電子メールが送信されます。Outlook クライアントの使用を避けるために SMTP ルーティングを使用しようとしています。Outlook クライアントの代わりに SMTP ルーティングを使用するように mail() 関数を構成する方法はありますか?
Re:SMTP設定「Mail()」を見てください。指示。
Re:SMTP設定私の意見では、この種の問題は通常、JMP ではなく Windows コマンドラインまたは PowerShell 内で問題が発生するため、Windows コマンドラインまたは PowerShell 内でデバッグする方が簡単です (ただし、JMP での引用に問題が発生する場合もあります)。
Re:SMTP設定特定の文字を含まないパスでも機能するようにしました(例:「è」、「é」...)。
メッセージやパスで特殊文字を使用するための特別な機能はありますか?

レジストリにこのエラー メッセージが表示されます
PowerShell でエンコードの種類を変更する行を追加しましたが、これでは問題は解決されません。


また、メール本文の行をスキップしようとしています。「\n」などのさまざまな方法を試しました... しかし、それは機能しません。
Re:SMTP設定おはよう、
あなたのメソッドを使用して電子メールの本文(-Body)を変更することは可能ですか?
たとえば、改行やスペースを入れてメールを書けるようになるでしょうか?
メールの例:
おはよう、
受け取る情報は次のとおりです。
- 情報1
- 情報2
ありがとう
Re:SMTP設定うまくいくか試してみましたか? 覚えていればそうなるはずですが、Powershell のルールに従って本体を構築する必要があるかもしれません (たとえば、 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.4#here-strings )。
Send-MailMessage を使用して JMP で電子メールを送信する関数を作成したとき、-Body だけを使用するよりも -BodyAsHtml を使用する方が簡単であることがわかりました。
Re:SMTP設定ご回答いただきありがとうございます。
例を示していただけますか?
私はすでにこのようなことを試しました
Re:SMTP設定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")
);Re:SMTP設定以下のスクリプトに追加することは可能でしょうか?
「注文」セクションでしょうか?
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;
);
)
)
);Re:SMTP設定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")
);Re:SMTP設定素晴らしいですね、ご返答ありがとうございます!
同様に、メールの本文に特殊文字を追加することはできますか?
Re:SMTP設定Send-Mailmessage には -Encoding パラメータがありますSend-MailMessage (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learnそれはうまくいくかもしれません。 あるいは、これらの here-string が必要か、HTML に変換してそこで管理する必要があるかもしれません。
編集:
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")
);
Re:SMTP設定お返事ありがとうございます。
特殊文字について話すとき、私は特に「é」または「à」のアクセントについて話しました。
Re:SMTP設定おはよう、
(-Attachment 部分で) 複数の添付ファイルを同時に追加することはできますか?
ご回答ありがとうございます
Re:SMTP設定Send-MailMessage に関するマイクロソフトのドキュメントを正しく読めば、複数のパスを指定できます (JMP を使用して複数の添付ファイルを送信しました)。