服务器配置 > SMTP 配置 > 为 PTC RV&S SMTP 电子邮件服务器配置 OAuth 身份验证
为 PTC RV&S SMTP 电子邮件服务器配置 OAuth 身份验证
要设置 SMTP 电子邮件服务器以进行 Oauth 令牌身份验证,必须在 is.properties 以及 security.properties 文件中配置以下特性。请务必确保所有特性均已正确配置,并且未留有空白项。
必须在 is.properties 文件中配置以下特性:
mksis.smtp.oauth.authentication - 将值设为 true 可使用 OAuth 令牌身份验证来发送邮件。将此特性设置为 false 可使应用程序使用开放式邮件转发发送邮件。
mksis.smtp.ssl.enabled -- 将该值设置为 true 可在 SMTP 服务器上启用 TLS 加密。仅当使用签名者许可证给 SMTP 服务器配置了 TLS 加密时,可使用该选项。如果 SMTP 服务器配置了 TLS 加密,则可以使用 keytool.exe 命令将签名者证书 (自定义根 CA 或自定义中间 CA) 从 SMTP 服务器导入受信任密钥库。keytool.exe 命令位于 JRE/JDK 文件夹中。

%jdk%\bin\keytool -importcert -alias <<SMTP Server name>> -storetype PKCS12
-keystore jdk\lib\security\cacerts
-file <custome_CA_certificate>
where
-importcert - specifies to import the certificate response
-alias - specifies the name of the entry from which to import
-file - specifies the path from which to read the CA response
You must repeat the command for all the CAs.
mksis.logging.email.from - 包含发件人的身份验证用户名。
mksis.logging.email.server.hostname - 包含 SMTP 服务器的名称。
mksis.logging.email.server.port - 包含端口号。
必须在 security.properties 文件中配置以下特性:
mksis.security.smtp.oauth.clientID - 包含邮件服务器的 OAuth 客户端 ID。
mksis.security.smtp.oauth.clientSecret - 包含邮件服务器的客户端密钥。
mksis.security.smtp.oauth.tokenEndpointURL - 包含用于生成令牌的电子邮件服务器的令牌 URL。
mksis.security.smtp.oauth.scope - 包含用于生成令牌的范围。
* 
切换邮件转发系统时,您必须考虑以下事项:
若要切换邮件转发,则需要重新启动服务器。
如果在使用 Oauth 令牌身份验证时修改了以上任何特性,则需要重新启动服务器。
* 
在添加或修改身份验证客户端 ID、客户端密钥、范围和令牌 URL 后,保存 security.properties 文件并运行加密工具。这样可确保 security.properties 文件中提供的客户端密钥被加密。
电子邮件触发器
若要继续使用开放式邮件转发,则无需进行任何更改,触发器会继续按预期运行。如果要迁移到 SMTP OAuth 令牌身份验证系统,则必须如上所述配置 is.propertiessecurity.properties 文件,并对应用程序提供的预设触发器脚本进行以下更改:
如果您使用的是 Java Mail API,请参阅示例触发器脚本 emailAdvanced_closedmail_OAuth.js,尤其是函数 getSMTPServer()getSMTPPort()getOAuthAccessToken()。还要确保使用适当的加密技术从这些函数中检索身份验证详情。
如您使用非 Java Mail API (sendmail() 函数),则必须使用与 SMTP 基本身份验证中所提供用户名一致的正确用户名。例如,您可以使用函数 eb.sendmail([email protected], email, subject, message)
* 
如果 mksis.smtp.oauth.authentication=truemksis.smtp.authentication=true,则使用 SMTP 基本身份验证来发送电子邮件。
如果 mksis.smtp.oauth.authentication=truemksis.smtp.authentication=false,则使用 SMTP OAuth 令牌身份验证来发送电子邮件。
这对您有帮助吗?