mail icon indicating copy to clipboard operation
mail copied to clipboard

If using contact groups emails are send to all e-mail adresses of the members

Open markuswochnik opened this issue 5 years ago • 11 comments

Hello everyone,

first the facts:

  • Nextcloud Version: 17.0.2
  • Mail Version: 1.0.0
  • Contacts Version: 3.1.6
  • Browser: Firefox 72.0.1 on Win 10 Pro 1909
  • Server: apache2 hosted on Ubuntu 18.04 with php7.3

Now the problem:

When sending an e-mail to a contact group, the mail will be send to all saved e-mail adresses of the contacts, not only to the main one.

This is kinda critical, because if i want to send to the business adresses to my colleagues, maybe the personal adresses will be leaked too if i saved some of them in the contacts.

Not sure how to debug that better. The contact groups are fine, when i send from thunderbird to the synced contact groups (CardBook) the mail is only send to the main e-mail address.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

markuswochnik avatar Jan 20 '20 21:01 markuswochnik

I see the problem. But could we detect the "main one"?

ChristophWurst avatar Jan 21 '20 08:01 ChristophWurst

In Thunderbird (CardBook) i can set the "preference tag" in the contact menu. So this is a thing that carddav can handle, in the VCARD there is "type=pref"

EMAIL;type=INTERNET;type=WORK;type=pref:[email protected] EMAIL;type=INTERNET;type=HOME:[email protected]

But currently as i see the contacts app doesn't have the option to define which e-mail is main. Maybe @skjnldsv has an idea to solve this.

For the mail app there could be a limit kind of "one mail per contact" and somewhere should be documented that always the "first" e-mail top-down would be chosen?

markuswochnik avatar Jan 21 '20 09:01 markuswochnik

For the mail app there could be a limit kind of "one mail per contact" and somewhere should be documented that always the "first" e-mail top-down would be chosen?

But how would you know what the "first" contact is. You could only tell this from the vcard. But any UI might sort the addresses in different orders, hence it's anything but clear.

:+1: on the pref tag. However, as you pointed out it doesn't seem to be used everywhere.

ChristophWurst avatar Jan 21 '20 09:01 ChristophWurst

Maybe something like this as a first step: "IF pref-tag=true THEN one-email ELSE all other e-mail addresses too"

And the contacts team could as second part implement the button that you can set this for your contacts?

markuswochnik avatar Jan 21 '20 10:01 markuswochnik

There is a long lasting issue in the contacts repo, hast sadly the label "low". https://github.com/nextcloud/contacts/issues/202

markuswochnik avatar Jan 21 '20 10:01 markuswochnik

Maybe something like this as a first step: "IF pref-tag=true THEN one-email ELSE all other e-mail addresses too"

And the contacts team could as second part implement the button that you can set this for your contacts?

That makes a lot of sense! @bfritscher do you remember if we have access to that property?

ChristophWurst avatar Jan 21 '20 13:01 ChristophWurst

I only created and tested with the contacts app. So in my tests I received either one string or an array of string, which contained the emails. No guarantee that the first is the preferred one.

bfritscher avatar Jan 21 '20 15:01 bfritscher

Ai. Thanks for the info.

The data might be present differently if that flag is set. Needs debugging.

ChristophWurst avatar Jan 21 '20 15:01 ChristophWurst

I don't have time to look into this right now. But if anyone wants to look into this please let me know :)

ChristophWurst avatar Jan 21 '20 15:01 ChristophWurst

I had a look and found https://github.com/nextcloud/server/blob/12bdb95c1a40170652570decef7f466e4b97aa65/apps/dav/lib/CardDAV/AddressBookImpl.php#L117

So currently as long as we don't pass ['types' => true] to contactManger->search we receive only emails. So at least there is no bug.

But this means that vCard2Array https://github.com/nextcloud/server/blob/12bdb95c1a40170652570decef7f466e4b97aa65/apps/dav/lib/CardDAV/AddressBookImpl.php#L247

has to be changed to support the pref tag, then we can change the group integration code. Also Pref is an integer 1 to 100 https://tools.ietf.org/html/rfc6350#section-5.3

bfritscher avatar Jan 21 '20 18:01 bfritscher

Nice finding. Mind submitting a PR to server?

ChristophWurst avatar Jan 23 '20 08:01 ChristophWurst