MP_SendEmail::send_email( string|array $to, string $subject, string $message, string|array $headers = '', string $attachments = '' )

Send Email.


Parameters Parameters

$to

(string|array) (Required) array or comma-separated list of email addresses to send message

$subject

(string) (Required) email subject

$message

(string) (Required) message contents

$headers

(string|array) (Optional) additional headers

Default value: ''

$attachments

(string) (Optional) attachment

Default value: ''


Top ↑

Return Return

(bool) Whether the email contents were sent successfully.


Top ↑

Source Source

File: mortgage-platform/Inc/Base/MP_SendEmail.php

    public function send_email($to, $subject, $message, $headers = '', $attachments = '')
    {
        $eol = PHP_EOL;

        if ('' === $headers) {
            $headers  = 'MIME-Version: 1.0' . $eol;
            $headers .= 'Content-type:text/html;charset=UTF-8' . $eol;
        }

        add_filter('wp_mail_from_name', array( $this, 'custom_wp_mail_from_name' ));

        add_filter('wp_mail_content_type', array( $this, 'set_html_content_type' ));

        $mailsend = wp_mail($to, $subject, $message, $headers, $attachments);

        remove_filter('wp_mail_content_type', array( $this, 'set_html_content_type' ));

        return $mailsend;
    }

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.