Skip to main content


!Friendica Support I have "Email administrators on new user registration" turned on... but I don't get any of these emails, other emails are being sent fine... anyone have any ideas?

Friendica Support reshared this.

in reply to Shiri Bailem

@Shiri Bailem
I have the same behaviour since the feature was introduced.
I am using a self hostet mail server (Postfix, Dovecot).
There is no connection attempt from friendica to the mail server.
This entry was edited (1 year ago)

Friendica Support reshared this.

Unknown parent

Raroun

@Roland Häder

I'm not really that deep into Dovecot.

But in the the file /etc/dovecot/conf.d/10-mail.conf there is the entry

mail_location = mbox:~/mail:INBOX=/var/mail/%u

This specifies how Dovecot should access an existing directory structure.

In my case the line is
mail_location = maildir:/var/mail/vhosts/%d/%n

which seems to fit your use too.
%d is the domain and %n is the user.

When I install Postfix and Dovecot, I always follow this tutorial:

How to install postfix an dovecot and roundcube

This entry was edited (1 year ago)

Friendica Support reshared this.

Unknown parent

Raroun
@Roland Häder
I would leave it as it is, actually see no chance to avoid the concat - but I have to admit im lousy at SQL :-D

Friendica Support reshared this.

in reply to Shiri Bailem

@Shiri Bailem With sendmail as mailserver it worked without problems on my instance. Meanwhile I use the "PHP Mailer SMTP" addon, because my mailserver is not on the same server anymore.

Friendica Support reshared this.

in reply to Shiri Bailem

@Shiri Bailem I can confirm it isn't an issue with the code, I've just tested the feature on my dev node and received the registration approval email.

Friendica Support reshared this.

in reply to Hypolite Petovan

@Hypolite Petovan I figured it was more likely a configuration issue on my end, which is why I posted here instead of github.

Are you using PHP mailer or the regular php sendmail/postfix system? I'm curious what might be the differences in configuration and what could be causing this to not go through?

Friendica Support reshared this.

in reply to Shiri Bailem

I checked every log file that exists - for what reason ever, only the "Email administrators on new user registration" mail doesn´t come through.
Ill try to check that tommorrow on my dev-instance.

BTW: i got even step debbugin working wird Friendica and xdebug. Im totally lost in the code but sooner or later i´ll get into it.

Friendica Support reshared this.

in reply to Shiri Bailem

@Hypolite Petovan @Shiri Bailem
I am still completely lost in the code, but was able to identify the problem.

/src/module/register.php

Line 403:
DI::notify()->createFromArray.

will never reached because:
Line 402:

foreach (User::getAdminListForEmailing(['uid', 'language', 'email']) as $admin)

returns an empty array. Of course, if the array is empty, no mail will be sent.

Unfortunately, I don't know why the array is empty, but with the following changes to the sendNotification function, the email arrived immediately:

Original code:

foreach (User::getAdminListForEmailing(['uid', 'language', 'email']) as $admin){
				DI::notify()->createFromArray([
				'type'                      => Model\Notification\Type::SYSTEM,
				'event'                     => $event,
				'uid'                       => $admin['uid'],
				'link'                      => DI::baseUrl() . '/moderation/users/',
				'source_name'               => $user['username'],
				'source_mail'               => $user['email'],
				'source_nick'               => $user['nickname'],
				'source_link'               => DI::baseUrl() . '/moderation/users/',
				'source_photo'              => User::getAvatarUrl($user, Proxy::SIZE_THUMB),
				'show_in_notification_page' => false

Modified code (getAdminEmailList instead of getAdminListForEmailing and uid was set manually):

foreach (User::getAdminEmailList(['uid', 'language', 'email']) as $admin) {
				DI::notify()->createFromArray([
				'type'                      => Model\Notification\Type::SYSTEM,
				'event'                     => $event,
				'uid'                       => '2',
				'link'                      => DI::baseUrl() . '/moderation/users/',
				'source_name'               => $user['username'],
				'source_mail'               => $user['email'],
				'source_nick'               => $user['nickname'],
				'source_link'               => DI::baseUrl() . '/moderation/users/',
				'source_photo'              => User::getAvatarUrl($user, Proxy::SIZE_THUMB),
				'show_in_notification_page' => false
This entry was edited (1 year ago)

Friendica Support reshared this.

in reply to Raroun

@Raroun @Shiri Bailem User::getAdminListForEmailing selects database records based on the email addresses included in the config.admin_email configuration value.

In addition, these records must have:

  • parent-uid = 0 (no delegate accounts)
  • blocked = 0
  • verified = true
  • account_removed = false
  • account_expired = false

Did you setup your admin account as a delegate?

Friendica Support reshared this.

in reply to Hypolite Petovan

@Hypolite Petovan @Shiri Bailem

Nope, no delegate. :(

What’s the difference to getAdminEmailList expect it can return unique emails more than one time?

This entry was edited (1 year ago)

Friendica Support reshared this.

in reply to Shiri Bailem

@Hypolite Petovan @Shiri Bailem
Got it.
I checked my dev instance and my prod instance. on both instances the parent ID of the admin is NULL but not 0.
a simple update user set `parent-uid` = '0' where uid ='2'; did the trick. Notification Emails are now arriving without changes to the code.

User::getAdminListForEmailing should be updated to check

parent-uid = 0 OR parent-uid = NULL

Obviously there are instances running where the parent-id is NULL.

My developer instance was a total fresh install - fresh os, fresh friendica and the parent-uid was NULL.

Anyway, we have a solution :)

This entry was edited (1 year ago)

Friendica Support reshared this.

in reply to Hypolite Petovan

@Hypolite Petovan @Raroun THANKS RAROUN!

This seems weird to me though, because on my instance the only accounts with parent-uid set to anything but NULL are delegates... So maybe there's something to figure out as to why they're not getting set to 0? Or maybe just have the code also look for null?

Friendica Support reshared this.

in reply to Shiri Bailem

@Hypolite Petovan @Shiri Bailem
I would check for parent-uid = 0 OR parent-uid = NULL in the code.
I don‘t know what caused this inconsistency between instances - but it seems for most admins this email notification feature works out of the box.¯\_(ツ)_/¯
This entry was edited (1 year ago)

Friendica Support reshared this.

in reply to Raroun

I can confirm that it's not working an my instance as well.
Will have a look later if it's the same reason as yours.

Thanks for your investigation

Friendica Support reshared this.

in reply to Shiri Bailem

@Hypolite Petovan
Should i create a pull request with a fix for User::getAdminList, or should we leave it as it is?

Friendica Support reshared this.

in reply to Raroun

@Raroun @Hypolite Petovan in absence of a response from Hypolite, I'd suggest yes. At the very least it's a way to document it and open formal discussion about how to address it.

Friendica Support reshared this.

in reply to Shiri Bailem

@Shiri Bailem
I like that Idea - will create an issue tomorrow "open for Discussion" :)

I´m fine with both options - leave it as it is and tell people the solution when they need it, or applying a fix - like a code based one or a standard value of "0" for that database collumn :)

Friendica Support reshared this.

in reply to Raroun

@Raroun @Shiri Bailem Pull requests are always welcome, it’s an excellent start of discussion even if it doesn’t get merged or not under its original form.

The user with uid = 0 is the system user so I’d rather not default the parent-uid to 0. Ideally we should only check that the value is null, but I’d be curious about the parent-uid = 0 condition intent.

Friendica Support reshared this.

in reply to Hypolite Petovan

@Hypolite Petovan @Shiri Bailem
I have seen that it´s not that easy like adding an "or".
But it´s possible - give me some time :)
in reply to Raroun

@Raroun @Shiri Bailem The PR has been merged, you can pull the latest develop branch and it should fix those parent-uid = 0 rows.

Friendica Support reshared this.