fast_events_email_api_result

This action is called after an order email has been send to the email-provider (Host-email, SMTP, Amazon SES, Mailgun, …). This call is made with both a successful email and an incorrect email (submission failed).

1<?php
2function your_action_email_api( $http_code, $order_id, $email, $result ) {
3  // Do what you need to do
4}
5
6add_action( 'fast_events_email_api_result', 'your_action_email_api', 10, 4 );

Parameters

$http_code

(int) The http resultcode. Consult the Mail Provider API for the right codes. The code may be in the 2xx-range (processing went ok) or an error (usually in the 4xx-range). For Host-email and SMTP this is 200 (Success) or 400 (Failure)

$order_id

(int) The id of the order.

$email

(string) The emailaddress of the recipient.

$result

(string) The result body after the Mail Provider API call. Consult your Mail Provider API for the format and content.


Return

None


Changelog

Version

Description

1.0

Introduced.


Examples

Send notification to admin if sending email failed

Send an email to the WordPress admin if there is an error sending the order email.

1<?php
2function your_action_email_api( $http_code, $order_id, $email, $result ) {
3  if ( 299 < $http_code ) {
4    $subject = 'Order #' . $order_id . ', ' . $email;
5    wp_mail( '[email protected]', $subject, $result );
6  }
7}
8
9add_action( 'fast_events_email_api_result', 'your_action_email_api', 10, 4 );