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

[REF] Use CRM_Utils_Mail::send for sending emails for confirming unsu… #17396

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

seamuslee001
Copy link
Contributor

…bscribe resubscribe auto replies and subscribing

Overview

This refactors the mail sending code for handling auto replies, unsubscribe/resubscribe/subscription confirmations to using the CRM_Utils_Mail::send method

Before

Multiple separate invocations of pear mail without running through a hook

After

Single invocation of pear mail and passing through the alterParams and alter content hooks

ping @eileenmcnaughton @mattwire

@civibot
Copy link

civibot bot commented May 26, 2020

(Standard links)

@civibot civibot bot added the master label May 26, 2020
@mattwire
Copy link
Contributor

@seamuslee001 Test fails relate

@mattwire
Copy link
Contributor

@seamuslee001 This is great! I had not realised that these messages bypassed hooks etc.

@seamuslee001 seamuslee001 force-pushed the use_util_mail_events branch 3 times, most recently from d3f76f5 to 2ad8bfe Compare May 27, 2020 22:24
@seamuslee001
Copy link
Contributor Author

@mattwire fixed the test failures now

@mattwire
Copy link
Contributor

@seamuslee001 I tested this on a system with mail set to "redirect to database" and one that can actually send mail. Clicking an unsubscribe link (eg https://example.org/civicrm/mailing/unsubscribe?reset=1&jid=59&qid=29&h=64c9d6be9bd2bb44) works without the patch (an email is sent) but does NOT seem to work with the patch - no email is sent?

@seamuslee001
Copy link
Contributor Author

@mattwire do you have any logs with errors?

@mattwire
Copy link
Contributor

@seamuslee001 No logs - it is because you are passing $params['to'] and CRM_Utils_Mail::send() requires $params['toEmail']

@seamuslee001 seamuslee001 force-pushed the use_util_mail_events branch from 2ad8bfe to 8658a3e Compare June 13, 2020 22:04
@seamuslee001
Copy link
Contributor Author

@mattwire that looks like to have been it, I have fixed that on all emails changed here and also expanded a mailing subscription test to check that the email is sent and that a sensible message id header is set as well

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 still failing :-(

@mlutfy
Copy link
Member

mlutfy commented Jun 16, 2020

In case the test result disappears from jenkins:

Stacktrace

api_v3_MailingGroupTest::testMailerProcess
Message-ID: <s .  not found in  MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="=_3fda462e069d3aa3be34e24d37f2c065"
From: "FIXME" <info@EXAMPLE.ORG>
To: <test@test.test>
Subject: Subscription Confirmation Request
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Return-Path: do-not-reply@setting.com
Reply-To: civicrm+c.4.2.acb3c277fc3b61a7@setting.com
Date: Sat, 13 Jun 2020 22:52:25 +0000
Message-ID: <civicrm+s.4.2.acb3c277fc3b61a7@setting.com>

…bscribe resubscribe auto replies and subscribing

Fix sending issues found by matt and expand unit test to cover sending of subscription emails
@seamuslee001 seamuslee001 force-pushed the use_util_mail_events branch from 8658a3e to 52f4ecb Compare June 19, 2020 23:59
@seamuslee001
Copy link
Contributor Author

@eileenmcnaughton @mattwire @mlutfy I believe I have fixed the test now

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 @mlutfy perhaps you could trade this for #17305

@demeritcowboy
Copy link
Contributor

jenkins test this please

@demeritcowboy
Copy link
Contributor

  • General standards
    • [r-explain] PASS
    • [r-user] PASS
    • [r-doc] PASS
    • [r-run] PASSed for the parts tested
      • Tested optout, unsubscribe, resubscribe.
      • Didn't test the others.
      • Tested with and without the generate Message-ID setting.
      • Didn't test hooks.
  • Developer standards
    • [r-tech] PASS
    • [r-code] PASS
    • [r-maint] PASS
    • [r-test] PASS

@seamuslee001
Copy link
Contributor Author

@eileenmcnaughton can you merge based on @demeritcowboy 's review

@eileenmcnaughton
Copy link
Contributor

thanks @demeritcowboy - really appreciate all the review work you do and I have a tonne of confidence in your ability to ferrit out any gotchas

@eileenmcnaughton eileenmcnaughton merged commit b908c76 into civicrm:master Jul 31, 2020
@mattwire
Copy link
Contributor

mattwire commented Aug 1, 2020

Thanks @demeritcowboy @eileenmcnaughton Sorry @seamuslee001 this fell off my radar!

@eileenmcnaughton eileenmcnaughton deleted the use_util_mail_events branch August 1, 2020 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants