Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailfrom config doesn't accept macros #1

Closed
andywebber opened this issue May 27, 2009 · 1 comment
Closed

mailfrom config doesn't accept macros #1

andywebber opened this issue May 27, 2009 · 1 comment

Comments

@andywebber
Copy link
Contributor

In DW core ( inc/common:notify() ) it is possible to use macros in the configuration parameter $conf['mailfrom'] - in particular @user@, @name@, @mail@.

Although the discussion plugin references the same config parameter, it does not do the same macro substitution in action.php:_notify(). It is therefore not possible to take advantage of the core feature of macro substitution in $conf['mailfrom'] when the discussion plugin is in use.

$ diff -u action.php.dist action.php
--- action.php.dist 2009-05-28 14:38:52.000000000 +0100
+++ action.php  2009-05-28 14:39:01.000000000 +0100
@@ -1067,11 +1067,16 @@
     function _notify($comment, &$subscribers) {
         global $conf;
         global $ID;
+        global $INFO;

         $notify_text = io_readfile($this->localfn('subscribermail'));
         $confirm_text = io_readfile($this->localfn('confirmsubscribe'));
         $subject_notify = '['.$conf['title'].'] '.$this->getLang('mail_newcomment');
         $subject_subscribe = '['.$conf['title'].'] '.$this->getLang('subscribe');
+        $from = $conf['mailfrom'];
+        $from = str_replace('@USER@',$_SERVER['REMOTE_USER'],$from);
+        $from = str_replace('@NAME@',$INFO['userinfo']['name'],$from);
+        $from = str_replace('@MAIL@',$INFO['userinfo']['mail'],$from);

         $search = array(
                 '@PAGE@',
@@ -1102,7 +1107,7 @@
                     );

                 $body = str_replace($search, $replace, $notify_text);
-                mail_send($to, $subject_notify, $body, $conf['mailfrom'], '', $bcc);
+                mail_send($to, $subject_notify, $body, $from, '', $bcc);
         }

         // notify comment subscribers
@@ -1124,7 +1129,7 @@
                             );

                     $body = str_replace($search, $replace, $notify_text);
-                    mail_send($to, $subject_notify, $body, $conf['mailfrom']);
+                    mail_send($to, $subject_notify, $body, $from);
                 } elseif(!$data['active'] && !$data['confirmsent']) {
                     $search = array(
                             '@PAGE@',
@@ -1140,7 +1145,7 @@
                             );

                     $body = str_replace($search, $replace, $confirm_text);
-                    mail_send($to, $subject_subscribe, $body, $conf['mailfrom']);
+                    mail_send($to, $subject_subscribe, $body, $from);
                     $subscribers[$mail]['confirmsent'] = true;
                 }
             }
@chimeric
Copy link

Thanks Andi! Applied!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants