diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/network.php | 52 |
1 files changed, 4 insertions, 48 deletions
diff --git a/include/network.php b/include/network.php index 50e8b1c89..a8ccee15c 100644 --- a/include/network.php +++ b/include/network.php @@ -2,6 +2,7 @@ use Zotlabs\Lib\Activity; use Zotlabs\Lib\Config; +use Zotlabs\Lib\Mailer; use Zotlabs\Lib\Zotfinger; use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Queue; @@ -1813,54 +1814,9 @@ function network_to_name($s) { */ function z_mail($params) { - if(! $params['fromEmail']) { - $params['fromEmail'] = Config::Get('system','from_email'); - if(! $params['fromEmail']) - $params['fromEmail'] = 'Administrator' . '@' . App::get_hostname(); - } - if(! $params['fromName']) { - $params['fromName'] = Config::Get('system','from_email_name'); - if(! $params['fromName']) - $params['fromName'] = Zotlabs\Lib\System::get_site_name(); - } - if(! $params['replyTo']) { - $params['replyTo'] = Config::Get('system','reply_address'); - if(! $params['replyTo']) - $params['replyTo'] = 'noreply' . '@' . App::get_hostname(); - } - - $params['sent'] = false; - $params['result'] = false; - - /** - * @hooks email_send - * * \e params @see z_mail() - */ - call_hooks('email_send', $params); - - if($params['sent']) { - logger('notification: z_mail returns ' . (($params['result']) ? 'success' : 'failure'), LOGGER_DEBUG); - return $params['result']; - } - - $fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8'); - $messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8'); - - $messageHeader = - $params['additionalMailHeader'] . - "From: $fromName <{$params['fromEmail']}>" . PHP_EOL . - "Reply-To: $fromName <{$params['replyTo']}>" . PHP_EOL . - "Content-Type: text/plain; charset=UTF-8"; - - // send the message - $res = mail( - $params['toEmail'], // send to address - $messageSubject, // subject - $params['textVersion'], - $messageHeader // message headers - ); - logger('notification: z_mail returns ' . (($res) ? 'success' : 'failure'), LOGGER_DEBUG); - return $res; + // Delegate the call to the Mailer class. + $mailer = new Mailer($params); + return $mailer->deliver(); } |