Salta al contenuto principale


!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?
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.
Questa voce è stata modificata (1 anno fa)
in reply to Raroun

@Raroun I'm currently having no mail server for pickup (delivery works, Postfix). I tried using #Dovecot but it seems it does not support mail folders like /var/mail/virtual/domain.tld[sub-domain]/user/{curr|new|temp}/ Can you help me with either converting it to a proper format (I don't want to loose these arrived mails) or making it compatible?
in reply to Roland Häder

@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 Postfix's 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

in reply to Raroun

@Raroun Okay, thank you. You have maybe helped me more than you can imagine. 😁 Because currently I have no POP3/IMAP running on my server, only for SMTP.
in reply to Roland Häder

@Raroun Now I'm stuck with this:
dovecot: pop3-login: Login: user=<my_user_name>, method=CRAM-MD5, rip=x.x.x.x, lip=x.x.x.x, mpid=29832, TLS, session=<XXXXX>
dovecot: pop3(my_user_name)<29832><XXXXX>: Error: mkdir(/var/mail/virtual//my_user_name) failed: Permission denied (euid=107(vmail) egid=8(mail) missing +w perm: /var/mail/virtual/, dir owned by 0:0 mode=0755)
dovecot: pop3(my_user_name)<29832><XXXXX>: Error: pop3_lock_session: Couldn't create root directory /var/mail/virtual//my_user_name: mkdir(/var/mail/virtual//roland) failed: Permission denied (euid=107(vmail) egid=8(mail) missing
dovecot: pop3(my_user_name)<29832><XXXXX>: Couldn't lock POP3 session top=0/0, retr=0/0, del=0/0, size=0

Of course I don't want to give that permission here, because the path lacks the domain part. I don't know what I have configured wrong here?
in reply to Roland Häder

@Raroun Yeah! Fixed! I had to include the domain name in the user field:
password_query = SELECT \
    CONCAT(u.mail_acc, '@', d.domain_name) AS user, \
    u.mail_pass AS password, \
    CONCAT('/var/mail/virtual/', d.domain_name, '/', u.mail_acc) AS userdb_home, \
    'vmail' AS userdb_uid, \
    'mail' AS userdb_gid \
  FROM mail_users AS u \
  INNER JOIN domain AS d \
  ON d.domain_id=d.domain_id \
  WHERE u.mail_acc = '%n' \
  AND d.domain_name = '%d' \
  LIMIT 1

Is my final query (prefetch for userdb). Maybe I can avoid the CONCAT() call here, by splitting it up?
in reply to Roland Häder

@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 😁
in reply to Raroun

@Raroun So far I downloaded ~20k mails from one account only and 30k are now coming in from an other ... 2-3 years of mails I wasn't able to download.
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.
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.
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?

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.

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 404:

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
in reply to Raroun

@Raroun@Shiri BailemUser::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?

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?

Questa voce è stata modificata (1 anno fa)
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 update 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 preant-uid was NULL.

Anyway, we have a solution 😀

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?

in reply to Shiri Bailem

@Hypolite Petovan@Shiri Bailem
I would check for parent-uid = 0 OR parent-uid = NULL
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.¯\_(ツ)_/¯
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?
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 😀

Friendica Support reshared this.

in reply to Shiri Bailem

Oh wow, thanks! 😀
@Hypolite Petovan
Questa voce è stata modificata (1 anno fa)

Friendica Support reshared this.

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.

⇧