Automator_Email_Helpers::send( $mail )
Contents
Parameters Parameters
-
(Required)
Return Return
(bool|mixed|void|Uncanny_AutomatorAutomator_WP_Error)
Source Source
File: src/core/lib/helpers/class-automator-email-helpers.php
public function send( $mail ) { /** * @param string $to * @param string $subject * @param string $body * @param array $headers * @param array $attachments * @param array $is_html */ $to = $mail['to']; $subject = $mail['subject']; $body = $mail['body']; $headers = $mail['headers']; $attachments = $mail['attachment']; $is_html = $mail['is_html']; $error = Automator()->error; if ( $to ) { if ( is_array( $to ) ) { foreach ( $to as $tt ) { if ( empty( $tt ) || ! is_email( $tt ) ) { if ( ! $error->get_message( 'wp_mail_to' ) ) { $error->add_error( 'wp_mail_to', esc_attr__( 'To address is empty.', 'uncanny-automator' ), $mail ); } } } } elseif ( empty( $to ) || ! is_email( $to ) ) { if ( ! $error->get_message( 'wp_mail_to' ) ) { $error->add_error( 'wp_mail_to', esc_attr__( 'To address is empty.', 'uncanny-automator' ), $mail ); } } } if ( empty( $headers ) ) { $headers = array(); } // if ( empty( $subject ) ) { // $error->add_error( 'subject_empty', esc_attr__( 'Email subject is empty.', 'uncanny-automator' ), $mail ); // } // // if ( empty( $body ) ) { // $error->add_error( 'body_empty', esc_attr__( 'Email body is empty.', 'uncanny-automator' ), $mail ); // } if ( empty( $attachments ) ) { $attachments = array(); } if ( ! empty( $error->get_messages() ) ) { return $error; } return wp_mail( $to, $subject, $body, $headers, $attachments ); }
Expand full source code Collapse full source code View on Github