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 发送了多个附件)