Falcon::get_from_address PHP Метод

get_from_address() публичный статический Метод

Defaults to the same default email as wp_mail(), including filters
public static get_from_address ( ) : string
Результат string Full email address
    public static function get_from_address()
    {
        $address = self::get_option('bbsub_from_email', false);
        if (empty($address)) {
            // Get the site domain and get rid of www.
            $sitename = strtolower($_SERVER['SERVER_NAME']);
            if (substr($sitename, 0, 4) == 'www.') {
                $sitename = substr($sitename, 4);
            }
            $address = 'wordpress@' . $sitename;
            $address = apply_filters('wp_mail_from', $address);
        }
        return $address;
    }

Usage Example

Пример #1
0
 public function send_mail($users, Falcon_Message $message)
 {
     $options = $message->get_options();
     $from = Falcon::get_from_address();
     $author = $message->get_author();
     $messages = array();
     foreach ($users as $user) {
         $data = array('from_email' => $from, 'to' => array(array('email' => $user->user_email, 'name' => $user->display_name)), 'subject' => $message->get_subject(), 'headers' => array('Reply-To' => $message->get_reply_address($user)));
         if ($author) {
             $data['from_name'] = $author;
         }
         if ($text = $message->get_text()) {
             $data['text'] = $text;
         }
         if ($html = $message->get_html()) {
             $data['html'] = $html;
         }
         // Set the message ID if we've got one
         if (!empty($options['message-id'])) {
             $data['headers']['Message-ID'] = $options['message-id'];
         }
         // If this is a reply, set the headers as needed
         if (!empty($options['in-reply-to'])) {
             $original = $options['in-reply-to'];
             if (is_array($original)) {
                 $original = isset($options['in-reply-to'][$user->ID]) ? $options['in-reply-to'][$user->ID] : null;
             }
             if (!empty($original)) {
                 $data['headers']['In-Reply-To'] = $original;
             }
         }
         if (!empty($options['references'])) {
             $references = implode(' ', $options['references']);
             $data['headers']['References'] = $references;
         }
         try {
             $messages[$user->ID] = $this->send_single($data);
         } catch (Exception $e) {
             $error = sprintf(__('Exception while sending: %s', 'falcon'), $e->getMessage());
             trigger_error($error, E_USER_WARNING);
         }
     }
     return $messages;
 }
All Usage Examples Of Falcon::get_from_address