Notify admins when a new members joins, not working?

Started by Ian GSD, February 03, 2016, 04:25:21 PM

Previous topic - Next topic

Ian GSD

Quote from: Sir Osis of Liver on July 05, 2011, 11:44:51 PM
/
If you hardcode your email address in /Sources/Subs-Post.php as shown, you should receive the emails.  It's a workaround - only one admin will get the notifications.  If it doesn't work, there's something else to try in the same function.

I'm having the same problem: all forum mail routines seem to be working except New Member notification to admins.  SMF 2.0.11, all files up to date according to maintenance, all DBs optimized, hard-coded my email address into /Sources/Subs-Post.php  but still don't get the admin notice.  What's the 'something else' you mentioned?

It's not in any spam traps and the host (media temple) says:

QuoteThere doesn't appear to be anything for [email protected] in the last 48 hours, and I uploaded a test PHP script to your site which sent a message to a test Gmail address without issue. It seems like the application you're using is not actually attempting to send out these messages. We are not completely familiar with this application and would unfortunately be unable to advise as to why it is not sending your messages.

I have not tried changing the subject because I haven't figured out where that is yet.

BTW, last notification received (yes, it was working for years) was 9/27/15.

This has been driving me nuts.

Steve

Ian, it's preferred that you start your own topic as this thread is 4 and a half years old and solved. :)
DO NOT pm me for support!

margarett

I have a different idea. We'll add the information to your error log, so that we can track what happened.

Find in Sources/Subs-Post.php:
// And do the actual sending...
sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 0);
}
$smcFunc['db_free_result']($request);

Add after:
log_error('A member has registered: ' . $member_name . '. ' . count($groups) . ' users are set to receive email notification');
This should add an entry to your error log every time a member registers *and* will let us know how many users is SMF trying to email with such information.

Try to create a test user and then login with your admin account to check your error log. Let us know the outcome ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Ian GSD

First, thanks to whoever moved this to a new topic.

margarett, Thank you for the help.  I made your changes and added a user.  Here's the error report form the forum.  Is there some way to look at the log itself or doesn't that tell you any more than the SMF report ( at /forum/index.php?action=admin;area=logs;sa=errorlog;desc)?



Of course, the user email showed up but the admin notification has not.

Illori

assuming you are 1 user that should have received the email, do you receive any email from your forum?

margarett

Ok you can delete the test user. It seems that the email should really go. Let me get to the computer for further debug. The code I suggested did its work as supposed ;)

I assume you're the only admin?

Edit: ninja'd
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Ian GSD

Illori, yesI am the only admin.  I was about to say that I get other notifications but those are coming to my personal email.  New user notifications are gong to the webmaster address, [email protected] (a gmail address), which forwards to me.

I'm going to change the webmaster address to my personal address and try adding another test user.

margarett, I'll let you know how that turns out.

Ian GSD

On further reflection, these should be going to the personal address in my forum profile, as I have Administrator as my primary group. N'est-ce pas?

FWIW, changing the webmaster address did not produce any different result.

margarett

I don't understand your mail setup, please bear with me will 'ya? ;)

I was about to say that I get other notifications but those are coming to my personal email.  New user notifications are gong to the webmaster address
How? If you choose to send a notification to admins when a new member joins (index.php?action=admin;area=regcenter;sa=settings) the following happens:
- SMF picks the email addresses from the members allowed to "moderate_forum"
- checks if these users have chosen to be notified of that stuff. If not, remove them from the "destination" list
- sends the notification email to each of them

So, you will receive any notification on the email associated to your account!

Also, ALL emails are sent *from* whatever address SMF has configured as "Webmaster Email Address"
index.php?action=admin;area=serversettings;sa=general

As far as I see it, there are only 2 emails associated to this process. Eg:
Your domain, eg: domain.com
Your "webmaster email address", from which ALL emails are sent by SMF, eg: [email protected]
Your user's email address, which might be (or not) the same as webmaster email address.

Or how do you have it set up?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Ian GSD

The webmaster address is [email protected].  (We do use the [email protected] setting in index.php?action=admin;area=modsettings.) The user address for me, as admin, is [email protected].

I get notifications of "report to moderator" on boards I moderate, "new post" when my posts have been replied to, "new message" when I get a new message, etc.  The only thing I'm not getting is "a new member has joined".

I have attached a couple of screen shots of the areas you mentioned; 'send a notification to admins when a new member joins' and 'server settings', just so there's no confusion. Might as well add the 'email settings' and 'noreply'.

I realize that the webmaster address should not be getting the "a new member has joined" emails but I wold like to make sure that it does get emails from the site.  Is there anyplace on the forum with a "contact webmaster" link? Any other way to mail the webmaster address from the forum?


margarett

I'm not familiar with that MOD. Could you please disable (or uninstall) it and try again? I would also advise you to enable the mail queue. Set it to 5/2
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Ian GSD


Ian GSD

OK, dumb question, I found it.  No Reply Emails - 1.3.8 (FWIW, this MOD was installed long before this problem arose.)

I got the attached error message when I tried to uninstall.  Should I proceed.  I'm wondering if it's failing because I have messed around with Subs-Post.php in the course of trying various suggestions from this forum. Maybe the system is trying to validate a file that I have touched and failing for that reason.

I'm tempted to replace the Subs-Post.php on the server with a clean copy from the install (is that even possible?) and try the uninstall again.

What do you suggest?

margarett

No, don't do that!

Please attach your Subs-Post.php
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Ian GSD

Here are the errors I'm getting (just figured out what that little pen & paper icon was for)

Error 1
Replace:
// Hmm.. Do we want to Do No Reply Mail?
if(isset($modSettings['enableNoReply']) && $modSettings['enableNoReply'] == 1)
{
// Prevent a bad webmaster email links.
if(empty($webmaster_replyemail))
$webmaster_replyemail = $webmaster_email;

// Hmm.. if they didn't set a NoReplyEmail lets make one up from [email protected]
$webmaster_email = (isset($modSettings['NoReplyEmail']) && !empty($modSettings['NoReplyEmail']) ? $modSettings['NoReplyEmail'] : 'noreply@' . str_replace('www.', '', $_SERVER['HTTP_HOST']));
        @ini_set('sendmail_from', $webmaster_email);

// Setup the message and end this.
$message .= $line_break . (isset($modSettings['NoReplyMessage']) && !empty($modSettings['NoReplyMessage']) ? $modSettings['NoReplyMessage'] : $txt['NoReplyMailDefault'] ) . ' ' . $webmaster_replyemail;
}

// Get rid of entities.
$subject = un_htmlspecialchars($subject);


With:
// Get rid of entities.
$subject = un_htmlspecialchars($subject);


Error 2
Replace:
$headers = 'From: "' . $from_name . '" <' . (empty($modSettings['mail_from']) ? (!empty($from_webmaster_email) ? $from_webmaster_email : $webmaster_email) : $modSettings['mail_from']) . '>' . $line_break;

With:
$headers = 'From: "' . $from_name . '" <' . (empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from']) . '>' . $line_break;

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Ian GSD

I get it now.  The Subs-Post.php file does not contain the replace code the uninstall is expecting to find!  Here's the file.


Ian GSD

I have to assume that the file got out of sync because someone prior to me did an install or update improperly.  If I jam the missing code into the file, the uninstall tests pass.  I have not uninstalled the MOD yet, however.

I did try adding another user after making that change, no difference but mail form the site always seems to take forever, so I'm going to give it a little more time.

This makes me wonder what else may have gotten screwed up by any possibly incorrect update/install. Is there some (hopefully simple) procedure to verify/validate an installation? how about to repair it?

What is still weirding me out is that it is just this one notification function that is not working.

Kindred

no no no no no....

you can't just "jam the missing code in"

The point of those code tests is that ANOTHER mod which you installed AFTER the first one apparently changed THE SAME SECTION of code.

So, by "jamming the missing code in" you have actually made matters worse -- because in reality, what you needed to do was FIND the code section that was being looked for (but did not exactly match the mod's code) and EDIT than MANUALLY to undo the mod changes.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Ian GSD

OK, my changes removed.

In looking for the 'code section that was being looked for (but did not exactly match the mod's code) and EDIT than MANUALLY to undo the mod changes' originally, the code sections that were being looked for were missing entirely. It wasn't a matter of not getting an exact match, those lines were just not there at all.

Anyhoo, now that the lines I added are removed again, how should I proceed with uninstalling the mod, ignore the failed tests and uninstall anyway?

Ian GSD

BTW, I am assuming that, rather than 'ANOTHER mod which you installed AFTER the first one apparently changed THE SAME SECTION of code', another mod or core update just plain re-wrote the file.  Doing a compare between the file in the full-install package and the one on our server reveals no difference at all between the two. I guess it's possible that NoReply was the only mod that would have touched that file (completely UNeducated guess on my part) but I would have thought something else would have touched it.

To test my theory, I ran the uninstall test on the 4 uninstallable MODs installed.  Results:

Join Password    1.0.3 - PASSED
No Reply Emails  1.3.8 - FAILED 2 tests in     ./Sources/Subs-Post.php
Aeva ~ Auto-Embed Video & Audio 7.2 - FAILED 1 test in      ./Sources/Subs-Post.php
nCode Image Resizer    1.3.1 - PASSED

I din't know if any of this is useful or even on point but ...

Kindred

It seems that some of your mods may never have been fully installed in the first place....

If those are your only mods, then restoring back to a clean set of files and reinstalling the mods that you want might be your best bet

and no... not a lot of mods are going to touch subs-post
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Ian GSD

Is there a step-by-step somewhere to restore back to a clean set of files? Do you think that might resolve my issue or that it's just a good idea, given the uninstall errors? Are config/setup settings saved somewhere, so I don't have to start from scratch in getting the forum back up? For example, I'm not sure if the DB connection settings will get lost.  How about everybody's roles, are they stored in the DB?

I know it's the slacker approach, but I'd much prefer to try an incremental approach first, uninstall individual mods and see if that can resolve the issue.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Ian GSD

Seems simple enough. (Famous last words).

margarett, I'll wait to hear from you before undertaking this.  Backing everything up (again) in the meantime.

margarett

Yeah, go ahead and restore clean files. Your file is totally clean, I have no idea why the mail isn't sent...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Ian GSD

QuoteI have no idea why the mail isn't sent...

Well, that's reassuring ...

I won't try this until I'm fit to drive. Margarett, I should have called you, sorry.

I'll let you know how it went tomorrow.

Ian GSD

#27
OK, so that was remarkably painless, if fruitless.  I got through the re-installation OK, got a bit of a scare when installation wanted to start.  I removed the install files and couldn't connect to the DB.  Good thing I'd backed up settings.php.

Not the most hair-raising reinstall I've been through.

Sadly, I'm still not getting new member notifications.  Oh well.  I appreciate both of your help.

On a side note, I have reinstalled our few MODs since trying to add test users.  All went OK except MOD Custom Board Sort    1.0.2 says it's not compatible with our version of SMF.  I have no idea what it did but it was installed prior to the reinstall.  Is there a newer version or replacement? (I have no clue where to look for this stuff).

Ooh.  Maybe I'll aks the google machine.

(Edit: I found the answer.  Emulation.  It installed when I emulated version 2.0)

Kindred

You did use the wrong set of files to do the clean...  Per the instructions You are supposed to use the large upgrade archive, not the install archive... This prevents the removal of the settings.php

Never the less, you got it done....   And you are still saying that it fails?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Ian GSD

Yes, it's still failing.

I could have sworn I got the large upgrade. Oops

Ian GSD

Do either of you know how to change the subject line of the 'new member' notification email? 

In my research, I came across someone with my problem that was having the outgoing message blocked by the host due to the subject line being spammy or something.  Media Temple has not admitted to doing this to us but I'd like to take one last shot at this problem. Of course, I can now not find that thread and haven't figured out where the subject line is defined yet.

Ian GSD

Never mind, I found it in Themes/default/languages/EmailTemplates.english.php

Changed subject to: domainname Admin Notice - New Member

Works like a charm.

Thanks you both for all your help.  Sorry to have wasted your time on a hosting issue.

margarett

Never *ever* remember reading something like that.
Thank you for letting us know ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: