Queries Library
Queries LibrarySend an email to the admin

Send an email to the admin

This query retrieves the email of the admin user from the WordPress wp_options table, and injects this value into the to field.

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
  }
}