BiologicalRecordsCentre / plantportal

Focused repo for the Plant Portal website
0 stars 0 forks source link

Indicia emails such as recording group (project) invitation no longer working on live #103

Closed andrewvanbreda closed 1 month ago

andrewvanbreda commented 2 months ago

Hi @BirenRathod (@sacrevert note for reference),

As I mentioned briefly earlier, have noticed that Plant Portal live emails have stopped working recently.

I noticed that inviting to a recording group/project fails with the following warning "The emails could not be sent due to a server configuration issue. Please contact the site admin."

This warning is actually just hard-coded for when the PHP mail function fails, e.g. a line like this is failing $thismailsuccess = mail($trimmedEmail, $lang['invitationToJoinRecordingGroup'], wordwrap($emailBodyHtml, 80), $headers);

I expect this problem is everywhere on the site, but group_send_invites.php is the file related to these examples.

Interestingly, the problem does NOT occur on Pantheon multidev sites, even newly cloned ones are not affected and send emails just file

BirenRathod commented 2 months ago

@andrewvanbreda If multisite is not affected which means the latest release of Drupal core 10.2.6 hasn't been rolled out yet. This update means it will update the symfony/mailer plugin.

This means that any code using the mail() function will not work eventually.

However, Drupal does send the emails because it is configured with SMTP. See screenshot. image

BirenRathod commented 2 months ago

@andrewvanbreda Can I have steps to reproduce, please?

andrewvanbreda commented 2 months ago

Hi @BirenRathod,

You need to login to Plant Portal's All Projects page.

https://plantportal.ceh.ac.uk/all-projects

You need to sign up to a project before you can invite people to a project. I would suggest joining "Standard Mode Test Project - AVB (please ignore)" Once joined, on that same page (All Projects) you will see some links appear next to the project you joined on the right. Click on the "Invite people to join" option and enter your own email and send.

The email will never arrive (although it seems to be different today, as today am not seeing an on screen error message...it is saying the email has sent but it is still not arriving).

To see it working, you can do the same thing on my multidev site here, this seems to send emails fine

https://avb-report-brc-plantportal-d10.pantheonsite.io/all-projects

BirenRathod commented 2 months ago

@andrewvanbreda If you don't see error that means the email has been delivered but got spoofed by UKCEH email policy. Because it uses the php() mail function to deliver those emails.

One more thing, the site uses the brc@ceh.ac.uk email address, so it is quite obvious. The policy only applies to live sites.

I also checked the php log files for any errors and I found no problem.

andrewvanbreda commented 2 months ago

Hi @BirenRathod OK thanks for looking. Well if it is OK today apart from the spoofing, then I suggest just letting me know when the general email problems with the policy have been fixed, and at that point I will retest and close this particular issue.

BirenRathod commented 2 months ago

@andrewvanbreda it is now down to John to implement the code. So as soon as I get it I will update that on all sites.

andrewvanbreda commented 1 month ago

@sacrevert Fixed after configuration changes made by Biren. I think also some bug fixes from John.