aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-10-01 03:06:01 -0700
committerredmatrix <mike@macgirvin.com>2016-10-01 03:06:01 -0700
commitfa94644bcfd5bb3ef9c4149d6503846a09975297 (patch)
tree7d04194a6fbb80c43af722fc20cb4a39574eabf4 /Zotlabs
parentad309f1036d9d85899c3d3199070d92dd96b1710 (diff)
downloadvolse-hubzilla-fa94644bcfd5bb3ef9c4149d6503846a09975297.tar.gz
volse-hubzilla-fa94644bcfd5bb3ef9c4149d6503846a09975297.tar.bz2
volse-hubzilla-fa94644bcfd5bb3ef9c4149d6503846a09975297.zip
Unify the various mail sending instance to enotify::send() and z_mail(). Both take the same arguments. z_mail() is text only, enotify::send() provides html and text. Both are pluggable using the enotfy_send hook.
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Enotify.php18
-rw-r--r--Zotlabs/Module/Invite.php15
-rw-r--r--Zotlabs/Module/Lostpass.php47
3 files changed, 49 insertions, 31 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 87a51b3a4..c25834a1f 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -71,9 +71,21 @@ class Enotify {
// Do not translate 'noreply' as it must be a legal 7-bit email address
- $sender_email = get_config('system','reply_address');
+ $reply_email = get_config('system','reply_address');
+ if(! $reply_email)
+ $reply_email = 'noreply' . '@' . $hostname;
+
+ $sender_email = get_config('system','from_email');
if(! $sender_email)
- $sender_email = 'noreply' . '@' . $hostname;
+ $sender_email = 'Administrator' . '@' . App::get_hostname();
+
+
+ $sender_name = get_config('system','from_email_name');
+ if(! $sender_name)
+ $sender_name = Zotlabs\Lib\System::get_site_name();
+
+
+
$additional_mail_header = "";
@@ -586,7 +598,7 @@ class Enotify {
self::send(array(
'fromName' => $sender_name,
'fromEmail' => $sender_email,
- 'replyTo' => $sender_email,
+ 'replyTo' => $reply_email,
'toEmail' => $recip['account_email'],
'messageSubject' => $datarray['subject'],
'htmlVersion' => $email_html_body,
diff --git a/Zotlabs/Module/Invite.php b/Zotlabs/Module/Invite.php
index 3d7438484..5198b1231 100644
--- a/Zotlabs/Module/Invite.php
+++ b/Zotlabs/Module/Invite.php
@@ -59,12 +59,15 @@ class Invite extends \Zotlabs\Web\Controller {
$account = \App::get_account();
-
- $res = mail($recip, sprintf( t('Please join us on $Projectname'), \App::$config['sitename']),
- $nmessage,
- "From: " . $account['account_email'] . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit' );
+ $res = z_mail(
+ [
+ 'toEmail' => $recip,
+ 'fromName' => ' ',
+ 'fromEmail' => $account['account_email'],
+ 'messageSubject' => t('Please join us on $Projectname'),
+ 'textVersion' => $nmessage,
+ ]
+ );
if($res) {
$total ++;
diff --git a/Zotlabs/Module/Lostpass.php b/Zotlabs/Module/Lostpass.php
index eeddd0a13..072657d7b 100644
--- a/Zotlabs/Module/Lostpass.php
+++ b/Zotlabs/Module/Lostpass.php
@@ -43,18 +43,19 @@ class Lostpass extends \Zotlabs\Web\Controller {
$subject = email_header_encode(sprintf( t('Password reset requested at %s'),get_config('system','sitename')), 'UTF-8');
- $res = mail($email, $subject ,
- $message,
- 'From: Administrator@' . $_SERVER['SERVER_NAME'] . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit' );
-
-
+ $res = z_mail(
+ [
+ 'toEmail' => $email,
+ 'messageSubject' => sprintf( t('Password reset requested at %s'), get_config('system','sitename')),
+ 'textVersion' => $message,
+ ]
+ );
+
goaway(z_root());
}
- function get() {
+ function get() {
if(x($_GET,'verify')) {
@@ -102,20 +103,22 @@ class Lostpass extends \Zotlabs\Web\Controller {
$email_tpl = get_intltext_template("passchanged_eml.tpl");
$message = replace_macros($email_tpl, array(
- '$sitename' => \App::$config['sitename'],
- '$siteurl' => z_root(),
- '$username' => sprintf( t('Site Member (%s)'), $email),
- '$email' => $email,
- '$new_password' => $new_password,
- '$uid' => $newuid ));
-
- $subject = email_header_encode( sprintf( t('Your password has changed at %s'), get_config('system','sitename')), 'UTF-8');
-
- $res = mail($email,$subject,$message,
- 'From: ' . 'Administrator@' . $_SERVER['SERVER_NAME'] . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit' );
-
+ '$sitename' => \App::$config['sitename'],
+ '$siteurl' => z_root(),
+ '$username' => sprintf( t('Site Member (%s)'), $email),
+ '$email' => $email,
+ '$new_password' => $new_password,
+ '$uid' => $newuid )
+ );
+
+ $res = z_mail(
+ [
+ 'toEmail' => $email,
+ 'messageSubject' => sprintf( t('Your password has changed at %s'), get_config('system','sitename')),
+ 'textVersion' => $message,
+ ]
+ );
+
return $o;
}