SMTP 設定是否可以設定 SMTP 伺服器以使用 JSL 透過 SMTP 中繼傳送電子郵件?查看 SAS 上的一些選項,但不確定如何使用 JSL 進行設定。謝謝
回覆: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;
);
)
)
);回覆:SMTP 設定我的文章帶有“-附件”功能以及相應的模型:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.1
在一些好的物品中,我找不到郵件。 J我們可以使用 une mauvaise 操作或使用 une mauvaise 語法。
您是否曾使用過 SVP 的腳本應用程式範例?
回覆:SMTP 設定您很可能可以使用所有不同的方法。 對於 PowerShell(我大部分時間都使用它),請參閱 Microsoft 文件。
回覆:SMTP 設定你好,
評論 je peux faire pour rajouter une pièce-jointe dans le mail svp ?
回覆: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
回覆:SMTP 設定明白了。 也許有一些幫助這個較早的線程。
回覆:SMTP 設定感謝您的答覆。當我使用 Mail() 函數時,電子郵件是透過 Outlook 用戶端發送的,這會阻止我自動發送電子郵件。我正在嘗試使用 SMTP 路由來避免使用 Outlook 用戶端。有沒有辦法設定 mail() 函數以使用 SMTP 路由而不是 Outlook 用戶端?
回覆:SMTP 設定看一下“Mail()”命令。
回覆:SMTP 設定在我看來,這類問題通常在 Windows 命令列或 powershell 中更容易調試,因為這些問題通常是在那裡出現的,而不是在 JMP 中出現的(有時在 JMP 中引用時會出現問題)。
回覆:SMTP 設定我設法讓它適用於沒有特定字符的路徑(例如:“è”,“é”...)
是否有在訊息和路徑中使用特殊字元的特殊函數?

我在註冊表中收到此錯誤訊息
我新增了一行來修改 PowerShell 中的編碼類型,但這並不能解決問題:


我還嘗試跳過電子郵件正文中的行,我嘗試了不同的方法,例如“\n”... 但它不起作用。
回覆:SMTP 設定早安,
是否可以使用您的方法修改電子郵件正文(在-Body中)?
例如,能夠撰寫帶有換行符和空格的電子郵件嗎?
電子郵件範例:
早安,
以下是您將收到的資訊:
- 訊息1
- 訊息2
謝謝
回覆: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 中編寫發送電子郵件的函數時,我確實發現使用 -BodyAsHtml 比僅使用 -Body 更容易。
回覆:SMTP 設定謝謝您的回答 !
你能舉個例子嗎?
我已經嘗試過這樣的事情
回覆: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")
);回覆: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;
);
)
)
);回覆: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")
);回覆:SMTP 設定太好了,謝謝您的回覆!
同樣,是否可以在電子郵件正文中添加特殊字元?
回覆:SMTP 設定Send-Mailmessage 有 -Encoding 參數傳送郵件訊息(Microsoft.PowerShell.Utility)- PowerShell |微軟學習這可以工作。 或者也許您需要這些此處的字串或轉換為 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")
);
回覆:SMTP 設定感謝你的回覆。
當談論特殊字元時,我特別談論“é”或“à”重音符號。
回覆:SMTP 設定早安,
是否可以同時新增多個附件(在-附件部分)?
謝謝您的回答
回覆:SMTP 設定如果我正確閱讀了 Send-MailMessage 的 microsoft 文檔,您可以為其提供多個路徑(並且我已使用 JMP 發送了多個附件)