Query 库
Query 库向管理员发送电子邮件

向管理员发送电子邮件

此 query 从 WordPress 的 wp_options 表中获取管理员用户的电子邮件地址,并将该值注入到 to 字段中。

query ExportData {
  adminEmail: optionValue(name: "admin_email")
    @export(as: "adminEmail")
}
 
mutation SendEmailToAdmin @depends(on: "ExportData") {
  _sendEmail(
    input: {
      to: $adminEmail
      subject: "Admin notification"
      messageAs: {
        html: "There is a new post on the site, go check!"
      }
    }
  ) {
    status
  }
}