New user email notification bug after 2.0.9 upgrade

Started by Black Tiger, November 26, 2014, 05:57:51 PM

Previous topic - Next topic

Arantor

This is the point we made originally; this is a situation that should never occur and SMF will not permit it if it has any control over it. I can't believe manually deleting emails would be considered an acceptable solution in vB's case either, to be honest, but given some of the... interesting... design decisions in vB, it's quite possible it is.

1) It's not actually problematic to the email login functionality, actually; if the username appears to be an email address when entered, it will simply look up the username attached to that email - but since there's no email to lookup in those cases, it won't be an issue.

2) I wasn't suggesting you changed that aspect of it, actually. I did expect you to be able to configure mailer-daemon to nullroute such emails though. As for notifications and announcements, that's all controllable from a user's profile (including turning off announcements). The announcement area will still offer the choice of overriding but the patch I suggested will curb the issue anyway.

3) Backups are a wonderful thing ;) If I do manual changes like that I tend to record them somewhere. But yes, that code will prevent the mail handler sending out email to null addresses. Since it's low cost, low risk and has beneficial side effects I also recommended it be added to 2.1.

P.S. as a solution to the empty email users, make SURE you delete them from inside SMF, not the database directly.

Black Tiger

In vB you can only login with your username and not with email addres, so it wouldn't be an issue if there's an email address or not I guess.

1.) On vB I could restrict certain usernames, because some dudes used arabic signs as usernames. So I also prohibited @ to prevent users using email addresses as a username. Which is a good thing because this prevents spam to their email accounts also.

2.) I don't think any host would null-route emails, Many times they are important notifications of things not going well. Often you can see in them that the recipients email box is full or that your domain is on a spamlist. So null route is not a good solution.

3.) I always have backups, also before and after I install a modification. However... After you converted and configured a complete SMF forum and users are already posting on it, you don't delete users from the old backup, and start from scratch with the conversion again.

So you suggest to delete the users from inside SMF? That would mean I have to note all names in mysql, then go to SMF and delete them one by one.
Luckily it's only about 20. But what is the thought behind it? What is the problem of deleting the users from the database directly? I'm just curious.
Greetings, Black Tiger

Arantor

1) SMF allows for this sort of thing too, incidentally. There's also a mod for disallowing emails as usernames to prevent people who really don't understand the spam concern.

2) Really? You wouldn't nullroute email that has no destination in the first place? Guess it depends on the setup you've got going on, but I've known places that just nullrouted such stuff at outbound.

3) Neither do I ;)

As for not deleting users directly in MySQL... do you have any idea how many clean-up queries get run by SMF at the same time when you delete a user? The exact same mentality we've been expressing with such agitation - that SMF doesn't expect people to mess with the DB directly - is present throughout SMF.

Black Tiger

1.) Ah cool. I will have a look for that mod.

2.) No. If possible I don't tamper with things. If it has no destination, it gets back to the sender, and that way the sender knows something is wrong. Otherwise he wouldn't know. If I did not have those mailer-daemon messages, I would never have known I had a problem because empty email in SMF is not good. Correct? ;)

As for the deleting of users, no sorry I don't have a clue because I never delete postings of a user. But I will gladly follow your advise and do it via the Admin panel of SMF as you suggested.

Just one last question, a bit off topic. I get tons of these messages:
Quote512: loadMemberContext(): member id 28085 not previously loaded by loadMemberData()
I read on the forums here that this is from users who were deleted before conversion.

An advise from endomorph in that thread was fix it by doing this:
update smf_messages
set id_member = 0 WHERE not exists
(select id_member from smf_members where smf_messages.id_member = smf_members.id_member )

But that was a thread from 2010.
Is this mysql command still good? And to I also have to use in that same line the things between the ( ) brackets? Like this?
update smf_messages set id_member = 0 WHERE not exists (select id_member from smf_members where smf_messages.id_member = smf_members.id_member );
Greetings, Black Tiger

Arantor

2) I can see that. Just saying I've seen other configurations too.

3) And that error is precisely why you do not delete users manually! It is precisely the case of deleting a user manually and then not updating the messages table (which is something SMF would do itself if you told it to delete a member and not delete their posts) that gives you that error.

The code looks fine to me, nothing has changed in SMF in forever that would affect that query.

Black Tiger

Awesome. Thank you again for the great help.

And I now also directly understand problems which could be caused by database deletion of users. Pity the convertor does not pick that up. But hey... some work must be left to do for us too. :)
Thanks!
Greetings, Black Tiger

Black Tiger

Just topping this again for feature references.

@Arantor if this code is applied (from previous page):
foreach ($to_array as $k => $v)
if (trim($v))
unset ($to_array[$k]);
if (empty($to_array))
return $mail_result;

Then totally no mail is send out anymore. I discovered this when a user tried to use the reset password failure. Forum said mail is send, no errors in the log, but no mail was send. After removing the code again, mail is send out again.
So something in this code is nog correct.
Greetings, Black Tiger

Arantor

Oh, this is what I get for doing it in a hurry.

if (trim($v) == '') not if (trim($v))

Black Tiger

Oke so the correct version should be:
foreach ($to_array as $k => $v)
if (trim($v) == '')
unset ($to_array[$k]);
if (empty($to_array))
return $mail_result;


Thanks!
Greetings, Black Tiger

Arantor


Advertisement: