Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sending messages to groups #6460

Merged
merged 1 commit into from
May 18, 2022
Merged

Conversation

ChristophWurst
Copy link
Member

Groups were expanded in the accounts controller. Since moving over to
the outbox logic this feature was missing and internal group identifiers
were passed to SMTP.

With this patch groups are expanded again just before a message is sent.
This means the group memberships are read as late as possible and
editing an outbox message looks like the original message because
members have not been expanded there yet.

How to test

  • Create a few contacts and form a group
  • Compose a new message, add the group as recipient
  • Send the message

On main/v1.12.0: 💥
Here: 😎

Regression of #6031
Fixes #6382

@kesselb
Copy link
Contributor

kesselb commented May 16, 2022

LGTM 👍

image

Question: I have a group admin and a user admin who belongs to the group. But the administrator was to lazy to set an email address. Without the email address it will fail at

return Address::fromRaw($recipient->getLabel() ?? $recipient->getEmail(), $recipient->getEmail());

@ChristophWurst
Copy link
Member Author

Question: I have a group admin and a user admin who belongs to the group. But the administrator was to lazy to set an email address. Without the email address it will fail at

Good question. But I don't know how we could/should improve this. We could validate the inputs when a message is added to the outbox. Right now we don't do any of that. You can also add obvious non-email addresses as a sender and the app will just store it.

@kesselb
Copy link
Contributor

kesselb commented May 16, 2022

Question: I have a group admin and a user admin who belongs to the group. But the administrator was to lazy to set an email address. Without the email address it will fail at

Good question. But I don't know how we could/should improve this. We could validate the inputs when a message is added to the outbox. Right now we don't do any of that. You can also add obvious non-email addresses as a sender and the app will just store it.

When one user has no email address sending to a group is still not possible and fails with:

Argument 2 passed to OCA\Mail\Address::fromRaw() must be of the type string, null given, called in /var/www/html/apps-extra/mail/lib/Service/MailTransmission.php on line 227.

The old code used this check to make sure that email is not empty.

image

Sounds like a good plan to add a warning to new message when some members of a group don't have a valid email address. So the sender is aware that not everyone is getting the email. Should i create a ticket for this?

@ChristophWurst ChristophWurst force-pushed the fix/sending-messages-to-groups branch 2 times, most recently from e48473e to 6ff7131 Compare May 17, 2022 14:17
@ChristophWurst
Copy link
Member Author

Question: I have a group admin and a user admin who belongs to the group. But the administrator was to lazy to set an email address.

I've added a filter for member to only consider those with an email address.

Groups were expanded in the accounts controller. Since moving over to
the outbox logic this feature was missing and internal group identifiers
were passed to SMTP.

With this patch groups are expanded again just before a message is sent.
This means the group memberships are read as late as possible and
editing an outbox message looks like the original message because
members have not been expanded there yet.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@LostinSpacetime
Copy link

I applied the patch and sending mails to groups is working. However, some email servers (GMX, web.de) didn't accept the mails, which didn't happen before. I get this error:

Remote host said: 554-Transaction failed
554-Reject due to policy restrictions.

Sending emails to the same recipients works if I don't use the group. Maybe the email headers are not syntactically correct.

@ChristophWurst
Copy link
Member Author

Could you file that as a new ticket @LostinSpacetime? Do you have access to the email headers/text that get rejected?

@ChristophWurst ChristophWurst merged commit 6a53576 into main May 18, 2022
@ChristophWurst ChristophWurst deleted the fix/sending-messages-to-groups branch May 18, 2022 12:37
@ChristophWurst
Copy link
Member Author

/backport to stable1.12

@LostinSpacetime
Copy link

Could you file that as a new ticket @LostinSpacetime? Do you have access to the email headers/text that get rejected?

I did file a new bug report here #6497
The problem was introduced with 1.12.0 but is not related to groups. It only happens if the address/es are in BCC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sending mails to groups fails (again!)
4 participants