Welcome to Geeklog, Anonymous Thursday, November 21 2024 @ 07:24 pm EST
Geeklog Forums
A public dummy site mail and a protected real site mail
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/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?
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?
15
13
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Here's my solution for this situation (it was officially submitted). I hope you'd implement it!
Config.php :
// 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:
COM_mail ($_CONF['site_mail'], $mailsubject, $mailbody);
To:
notification($mailsubject, $mailbody);
And finally,
lib-common.php (or something alike):
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);
}
Config.php :
Text 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:
Text Formatted Code
COM_mail ($_CONF['site_mail'], $mailsubject, $mailbody);
To:
Text Formatted Code
notification($mailsubject, $mailbody);
And finally,
lib-common.php (or something alike):
Text 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);
}
14
13
Quote
All times are EST. The time is now 07:24 pm.
- 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