代码仓
中
SmtpService
更新时间: 2026/11/04
在AtomGit上查看源码

ResourceDefinition ​

uris ​

  • /redfish/v1/Managers/manager_id/SmtpService

properties ​

名称类型是否只读取值范围/枚举值说明
@odata.contextstringtrue-SMTP服务资源模型的OData描述信息
@odata.idstringtrue-SMTP服务资源的访问路径
@odata.typestringtrue-SMTP服务资源的类型
Namestringtrue-SMTP服务资源的名称
Idstringtrue-SMTP服务资源的ID
ServiceEnabledbooleanfalse-SMTP服务的使能状态
CertVerificationEnabledbooleanfalse-SMTP校验服务端证书使能说明该属性自8.91版本(1710),3.8.0.1版本(1711)开始使用
ServerAddressstringfalse-SMTP服务器地址
ServerPortnumberfalse-SMTP服务器端口
TLSEnabledbooleanfalse-是否启用TLS
AnonymousLoginEnabledbooleanfalse-是否使用匿名
SenderUserNamestringfalse-发件人用户名
SenderPasswordstringfalse-发件人密码
SenderAddressstringfalse-发件人电子邮箱
EmailSubjectstringfalse-邮件主题
EmailSubjectContains[ ]arrayfalse-主题附加信息
● HostName:主机名
● BoardSN:主板序列号
● ProductAssetTag:产品资产标签
ReportTypestringfalse-上报事件类型:
● OemEvent:自定义事件
● SEL:传感器事件
RootCertificate {objecttrue-根证书信息
RootCertificate.Subjectstringtrue-证书使用者
RootCertificate.Issuerstringtrue-证书签发者
RootCertificate.ValidNotBeforestringtrue-生效起始日期
RootCertificate.ValidNotAfterstringtrue-生效结束日期
RootCertificate.SerialNumberstringtrue-证书序列号
RootCertificate.SignatureAlgorithmstringtrue-签名算法
RootCertificate.KeyUsagestringtrue-密钥用法
RootCertificate.PublicKeyLengthBitsnumbertrue-公钥长度
}
RecipientAddresses [ {arraytrue-收件人地址列表
RecipientAddresses[].MemberIdstringfalse-序号
RecipientAddresses[].Enabledbooleanfalse-启用状态
RecipientAddresses[].EmailAddressstringfalse-收件人电子邮箱地址
RecipientAddresses[].Descriptionstringfalse-描述
} ]
Actions {objecttrue-SMTP服务组密钥导入操作
Actions.#SmtpService.SubmitTestEvent {objecttrue-发送测试事件
Actions.#SmtpService.SubmitTestEvent.@Redfish.ActionInfostringtrue-Action操作信息查询路径
Actions.#SmtpService.SubmitTestEvent.targetstringtrue-Action操作路径
}
Actions.#SmtpService.ImportRootCertificate {objecttrue-导入根证书说明该接口自8.91版本(1710),3.8.0.1版本(1711)开始使用
Actions.#SmtpService.ImportRootCertificate.targetstringtrue-Action操作路径
Actions.#SmtpService.ImportRootCertificate.@Redfish.ActionInfostringtrue-Action操作信息查询路径
}
}

supported_methods ​

  • GET
  • PATCH
  • POST

HTTP methods ​

GET ​

命令功能

查询 SMTP 资源信息

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SmtpService

请求头:

text
X-Auth-Token: auth_value

请求消息体: 无

参数说明

参数参数说明取值
device_ip登录设备的IP地址IPv4或IPv6地址
auth_value请求消息的鉴权参数可通过/redfish/v1/SessionService/Sessions创建会话时获得

使用指南

无

使用实例

请求样例: GET https://device_ip/redfish/v1/Managers/manager_id/SmtpService

X-Auth-Token: auth_value 请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#HwSmtpService.HwSmtpService",
"@odata.id": "/redfish/v1/Managers/1/SmtpService",
"@odata.type": "#HwSmtpService.v1_0_0.HwSmtpService",
"Id": "SmtpService",
"Name": "Smtp",
"ServiceEnabled": false,
"CertVerificationEnabled": false,
"AnonymousLoginEnabled": false,
"ServerAddress": null,
"ServerPort": 25,
"TLSEnabled": true,
"SenderUserName": null,
"SenderPassword": null,
"SenderAddress": null,
"EmailSubject": "Server Alert",
"EmailSubjectContains": [],
"RootCertificate": {
"Issuer": "CN=xxx, OU=IT, O=xxx, L=, S=GuangDong, C=CN",
"Subject": "CN=xxx, OU=IT, O=xxx, L=, S=GuangDong, C=CN",
"ValidNotBefore": "Jan 28 2016 GMT",
"ValidNotAfter": "Jan 27 2019 GMT",
"SerialNumber": "d5 39 e6 3a 2d 53 de 90",
"SignatureAlgorithm": "sha256WithRSAEncryption",
"KeyUsage": "Certificate Signing, CRL Sign",
"PublicKeyLengthBits": 2048
},
"RecipientAddresses": [
{
"MemberId": "0",
"Enabled": false,
"EmailAddress": null,
"Description": null
},
{
"MemberId": "1",
"Enabled": false,
"EmailAddress": null,
"Description": null
},
{
"MemberId": "2",
"Enabled": false,
"EmailAddress": null,
"Description": null
},
{
"MemberId": "3",
"Enabled": false,
"EmailAddress": null,
"Description": null
}
],
"ReportType": "SEL",
"Actions": {
"#SmtpService.SubmitTestEvent": {
"target": "/redfish/v1/Managers/1/SmtpService/Actions/SmtpService.SubmitTestEvent",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SmtpService/SubmitTestEventActionInfo"
},
"#SmtpService.ImportRootCertificate": {
"target": "/redfish/v1/Managers/1/SmtpService/Actions/SmtpService.ImportRootCertificate",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SmtpService/ImportRootCertificateActionInfo"
}
}
}

响应码:200

PATCH ​

命令功能

修改 SMTP 资源属性

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SmtpService

请求头:

text
X-Auth-Token: auth_value
Content-Type: header_type
If-Match: ifmatch_value

请求消息体:

json
{
"ServiceEnabled": ServiceEnabled_value,
"CertVerificationEnabled": CertVerificationEnabled_value,
"ServerAddress": ServerAddress_value,
"ServerPort": ServerPort_value,
"TLSEnabled": TLSEnabled_value,
"AnonymousLoginEnabled": AnonymousLoginEnabled_value,
"SenderUserName": SenderUserName_value,
"SenderPassword": SenderPassword_value,
"SenderAddress": SenderAddress_value,
"EmailSubject": EmailSubject_value,
"EmailSubjectContains": EmailSubjectContains_value,
"AlarmSeverity": AlarmSeverity_value,
"ReportType": ReportType_value,
"RecipientAddresses": [
{
"Enabled": Enabled_value,
"EmailAddress": EmailAddress_value,
"Description": Description_value
}
]
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
ServiceEnabledSMTP服务使能● true
● false
CertVerificationEnabledSMTP校验服务端证书使能● true
● false
ServerAddressSMTP服务地址字符串类型值说明未启用匿名时修改该参数属性需要同时修改发件人密码
ServerPortSMTP服务端口1~65535
TLSEnabledTLS启用设置● true
● false
AnonymousLoginEnabled是否使用匿名● true
● false说明使用匿名模式发件人密码将自动清空。
SenderUserName发件人用户名字符串类型值说明未启用匿名时修改该参数属性需要同时修改发件人密码。
SenderPassword发件人密码字符串类型值
SenderAddress发件人邮箱字符串类型值
EmailSubject邮箱主题字符串类型值
EmailSubjectContains主题附加信息可设置主机名、单板序列号、产品资产标签一个或多个
AlarmSeverity告警发送级别● Critical(紧急)
● Major(严重及以上)
● Minor(轻微及以上)
● Normal(正常及以上)
● null(不发送告警)
ReportType上报事件类型● OemEvent:自定义事件
● SEL:传感器事件
Enabled接收告警的邮件启用状态● true
● false
EmailAddress电子邮箱地址字符串类型值
Description描述字符串类型值

使用指南

可以同时设置多个属性

使用实例

请求样例: PATCH https://device_ip/redfish/v1/Managers/manager_id/SmtpService

X-Auth-Token: auth_value Content-Type: header_type If-Match: ifmatch_value 请求消息体:

json
{
"ServiceEnabled": ServiceEnabled_value,
"CertVerificationEnabled": CertVerificationEnabled_value,
"ServerAddress": ServerAddress_value,
"ServerPort": ServerPort_value,
"TLSEnabled": TLSEnabled_value,
"AnonymousLoginEnabled": AnonymousLoginEnabled_value,
"SenderUserName": SenderUserName_value,
"SenderPassword": SenderPassword_value,
"SenderAddress": SenderAddress_value,
"EmailSubject": EmailSubject_value,
"EmailSubjectContains": EmailSubjectContains_value,
"AlarmSeverity": AlarmSeverity_value,
"ReportType": ReportType_value,
"RecipientAddresses": [
{
"Enabled": Enabled_value,
"EmailAddress": EmailAddress_value,
"Description": Description_value
}
]
}

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#HwSmtpService.HwSmtpService",
"@odata.id": "/redfish/v1/Managers/1/SmtpService",
"@odata.type": "#HwSmtpService.v1_0_0.HwSmtpService",
"Id": "SmtpService",
"Name": "Smtp",
"ServiceEnabled": false,
"CertVerificationEnabled": false,
"ServerAddress": null,
"ServerPort": 25,
"TLSEnabled": true,
"AnonymousLoginEnabled": false,
"SenderUserName": "",
"SenderPassword": null,
"SenderAddress": null,
"EmailSubject": "Server Alert",
"EmailSubjectContains": [],
"AlarmSeverity": "Normal",
"RootCertificate": {
"Issuer": "CN=xxx, OU=IT, O=xxx, L=, S=GuangDong, C=CN",
"Subject": "CN=xxx, OU=IT, O=xxx, L=, S=GuangDong, C=CN",
"ValidNotBefore": "Jan 28 2016 GMT",
"ValidNotAfter": "Jan 27 2019 GMT",
"SerialNumber": "d5 39 e6 3a 2d 53 de 90",
"SignatureAlgorithm": "sha256WithRSAEncryption",
"KeyUsage": "Certificate Signing, CRL Sign",
"PublicKeyLengthBits": 2048
},
"RecipientAddresses": [
{
"MemberId": "0",
"Enabled": false,
"EmailAddress": "smtptest@it.software.com",
"Description": "smtptest"
},
{
"MemberId": "1",
"Enabled": false,
"EmailAddress": null,
"Description": null
},
{
"MemberId": "2",
"Enabled": false,
"EmailAddress": null,
"Description": null
},
{
"MemberId": "3",
"Enabled": false,
"EmailAddress": null,
"Description": null
}
],
"ReportType": "SEL",
"Actions": {
"#SmtpService.SubmitTestEvent": {
"target": "/redfish/v1/Managers/1/SmtpService/Actions/SmtpService.SubmitTestEvent",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SmtpService/SubmitTestEventActionInfo"
}
}
}

响应码:200

POST (ACTION) ​

ImportRootCertificate ​

命令功能

导入 SMTP 根证书

说明 须知 此资源已经废弃,仅供兼容性用途使用。建议使用redfish/v1/CertificateService接口 进行CA证书/吊销列表管理 自openUBMC 25.12 LTS版本后CA证书升级为资源池,所有BMC业务共用资源池中的CA证 书,此接口导入证书会影响到其他包含根证书的接口。共用CA证书业务包括: Syslog、SMTP、LDAP、SSL证书自动更新、远程HTTPS服务器、双因素登录业务

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SmtpService/Actions/SmtpService.ImportRootCertificate

请求头:

text
X-Auth-Token: auth_value
Content-Type: header_type

请求消息体:

json
{
"Type": type,
"Content": value
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
type导入smtp证书的方式● text,表明value值是证书内容
● URI,表明value值是URI(本地或者远程)
value内容1:可以是证书的内容2:可以是证书本地路径(只能在/tmp目录下)或者远程路径(支持的文件传输的协议有https、sftp、nfs、cifs、scp)3:value的含义由type表示

使用指南

无

使用实例

请求样例: POST https://device_ip/redfish/v1/Managers/manager_id/SmtpService/Actions/SmtpService.ImportRootCertificate

X-Auth-Token: auth_value Content-Type: header_type 请求消息体:

json
{
"Type": type,
"Content": value
}

响应样例:

json
{
"error": {
"code": "Base.1.0.GeneralError",
"message": "A general error has occurred. See ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_0.Message",
"MessageId": "iBMC.1.0.CertImportOKNone",
"RelatedProperties": [],
"Message": "The certificate has been imported successfully.",
"MessageArgs": [],
"Severity": "OK",
"Resolution": "None"
}
]
}
}

响应码:200

POST (ACTION) ​

SubmitTestEvent ​

命令功能

发送 SMTP 测试邮件

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SmtpService/Actions/SmtpService.SubmitTestEvent

请求头:

text
X-Auth-Token: auth_value
Content-Type: header_type

请求消息体:

json
{
"MemberId": value
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
value序号0,1,2,3

使用指南

无

使用实例

请求样例: POST https://device_ip/redfish/v1/Managers/manager_id/SmtpService/Actions/SmtpService.SubmitTestEvent

X-Auth-Token: auth_value Content-Type: header_type 请求消息体:

json
{
"MemberId": value
}

响应样例:

json
{
"error": {
"code": "Base.1.0.GeneralError",
"message": "A general error has occurred. See ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_0.Message",
"MessageId": "Base.1.0.Success",
"RelatedProperties": [],
"Message": "Successfully Completed Request",
"MessageArgs": [],
"Severity": "OK",
"Resolution": "None"
}
]
}
}

响应码:200