aboutsummaryrefslogtreecommitdiffstats
path: root/include/account.php
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 /include/account.php
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 'include/account.php')
-rw-r--r--include/account.php52
1 files changed, 30 insertions, 22 deletions
diff --git a/include/account.php b/include/account.php
index bd4da6a52..b78c3e56d 100644
--- a/include/account.php
+++ b/include/account.php
@@ -246,20 +246,23 @@ function verify_email_address($arr) {
dbesc($arr['account']['account_language'])
);
+//@fixme - get correct language template
+
$email_msg = replace_macros(get_intltext_template('register_verify_member.tpl'), array(
'$sitename' => get_config('system','sitename'),
- '$siteurl' => z_root(),
+ '$siteurl' => z_root(),
'$email' => $arr['email'],
'$uid' => $arr['account']['account_id'],
'$hash' => $hash,
'$details' => $details
));
- $res = mail($arr['email'], email_header_encode(sprintf( t('Registration confirmation for %s'), get_config('system','sitename'))),
- $email_msg,
- 'From: ' . 'Administrator' . '@' . App::get_hostname() . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit'
+ $res = z_mail(
+ [
+ 'toEmail' => $arr['email'],
+ 'messageSubject' => sprintf( t('Registration confirmation for %s'), get_config('system','sitename')),
+ 'textVersion' => $email_msg,
+ ]
);
if($res)
@@ -321,11 +324,12 @@ function send_reg_approval_email($arr) {
'$details' => $details
));
- $res = mail($admin['email'], sprintf( t('Registration request at %s'), get_config('system','sitename')),
- $email_msg,
- 'From: ' . t('Administrator') . '@' . App::get_hostname() . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit'
+ $res = z_mail(
+ [
+ 'toEmail' => $admin['email'],
+ 'messageSubject' => sprintf( t('Registration request at %s'), get_config('system','sitename')),
+ 'textVersion' => $email_msg,
+ ]
);
if($res)
@@ -348,12 +352,14 @@ function send_register_success_email($email,$password) {
'$password' => t('your registration password'),
));
- $res = mail($email, sprintf( t('Registration details for %s'), get_config('system','sitename')),
- $email_msg,
- 'From: ' . t('Administrator') . '@' . App::get_hostname() . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit'
+ $res = z_mail(
+ [
+ 'toEmail' => $email,
+ 'messageSubject' => sprintf( t('Registration details for %s'), get_config('system','sitename')),
+ 'textVersion' => $email_msg,
+ ]
);
+
return($res ? true : false);
}
@@ -399,7 +405,7 @@ function account_allow($hash) {
push_lang($register[0]['lang']);
$email_tpl = get_intltext_template("register_open_eml.tpl");
- $email_tpl = replace_macros($email_tpl, array(
+ $email_msg = replace_macros($email_tpl, array(
'$sitename' => get_config('system','sitename'),
'$siteurl' => z_root(),
'$username' => $account[0]['account_email'],
@@ -408,11 +414,13 @@ function account_allow($hash) {
'$uid' => $account[0]['account_id']
));
- $res = mail($account[0]['account_email'], sprintf( t('Registration details for %s'), get_config('system','sitename')),
- $email_tpl,
- 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit' );
+ $res = z_mail(
+ [
+ 'toEmail' => $account[0]['account_email'],
+ 'messageSubject' => sprintf( t('Registration details for %s'), get_config('system','sitename')),
+ 'textVersion' => $email_msg,
+ ]
+ );
pop_lang();