Welcome to Geeklog Saturday, December 07 2019 @ 07:31 am EST

Geeklog Forums

A public dummy site mail and a protected real site mail


Status: offline

LWC

Forum User
Full Member
Registered: 19/02/04
Posts: 818
$_CONF['site_mail'] is supposed to be a public e-mail address. Actually, it's the only e-mail address Geeklog doesn't protect.

Well, we all know that the site obviously has to use something in the "from" header when it sends something to the users.
Which is exactly why I - as well as most of the sites - always use something that starts with something like no_reply@.

But there comes a time when you need to send something to yourself so you can't you no_reply@ after all...at least if you want to use $_CONF['notification'].

Those notifications are found in multiple files in multiple sections. There's no central place to easily have them sent to another address (an actual address or by using a certain uid).

Therefore, I suggest to have 2 site_mails:
$_CONF['site_mail']
and
$_CONF['default_contact]
When Geeklog needs to send a message to you, it will only use the former if the latter isn't set.

So what do you think?
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 19/02/04
Posts: 818
Here's my solution for this situation (it was officially submitted). I hope you'd implement it!

Config.php :
PHP Formatted Code

// This is the return address for all email sent by Geeklog:
$_CONF['site_mail']         = 'noreply@mydomain.com';
// This is the target address for notifications sent by Geeklog:
// (could be either a uid or a username)
// $_CONF['default_contact'] = 2;




 

The reason it's disabled is so it doesn't take away anything from existing sites! In other words, you can not use it by mistake as it won't work unless you uncomment it (see below)!

Note that it can either a uid or a username!

system/lib-comment.php (> Geeklog v1.4)
public_html/comment.php (< Geeklog v1.4)
As well as any other file that has notifications!
From:
PHP Formatted Code

    COM_mail ($_CONF['site_mail'], $mailsubject, $mailbody);




 

To:
PHP Formatted Code

notification($mailsubject, $mailbody);




 

And finally,
lib-common.php (or something alike):
PHP Formatted Code

function notification($mailsubject, $mailbody) {
global $_CONF, $_TABLES;

$result = -1;
if (isset($_CONF['default_contact'])) {
if (is_numeric($_CONF['default_contact']))
$default_type = 'uid';
else
$default_type = 'username';

            $result = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE $default_type = {$_CONF['default_contact']}");
}
if ($result) {
            $A = DB_fetchArray($result);
            if (!empty ($A['fullname'])) {
                $to = COM_formatEmailAddress ($A['fullname'], $A['email']);
            } else {
                $to = COM_formatEmailAddress ($A['username'], $A['email']);
            }
    COM_mail ($to, $mailsubject, $mailbody);
} else
    COM_mail ($_CONF['site_mail'], $mailsubject, $mailbody);
}



 
 Quote

All times are EST. The time is now 07:31 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content