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

CRM-21574 Allow to disable sending of email from source contact for tell a friend on pcp #11425

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented Dec 17, 2017

Overview

I've pulled out the NFC changes in this PR into #12355 which should be reviewed/merged first.

When sending emails for personal campaign pages and enabling the "Tell a Friend" functionality it tries to send email from the contact IDs email address. However this is not always desirable as it can break SPF/DMARC and lead to bounced/failed email delivery.

@bgm I think you might be interested in - as it's not something I actually use :-) But thought I'd take a quick look as I needed to for activity assignees


@mattwire mattwire force-pushed the CRM-21574_disable_contact_email_tellafriend branch from 760f57d to 0df107f Compare January 12, 2018 11:44
@mattwire
Copy link
Contributor Author

@mlutfy Would you take a look at this when you get a moment? As I know you have an interest.

@mattwire
Copy link
Contributor Author

Jenkins test this please

@mattwire mattwire force-pushed the CRM-21574_disable_contact_email_tellafriend branch from 0df107f to a6fca2c Compare January 17, 2018 11:58
@mattwire
Copy link
Contributor Author

@yashodha Would you have time to look at this? It's the last piece of the emails from source contact stuff.

@stesi561
Copy link
Contributor

stesi561 commented May 9, 2018

Hey @mattwire, spotted your msg about this on chat and got inspired to try a review.

I'm getting an error when "Allow Mail to be sent from logged in contact's email address" is unticked.

Undefined index: email_from in CRM_Friend_BAO_Friend::sendMail() (line 328 of CRM/Friend/BAO/Friend.php)

My reading is this is not an issue with the patch - but that the previous behaviour was masking the issue. Before the patch the test for an empty value in $values['email_from'] was not wrapped in the conditional so this error didn't occur.

I think if we add an else on line 195 that catches the case for a contribution page where the receipt email is not set that inserts a sensible from address value?

The other issue I think we might need to think about with this is that while this changes what happens in the code - what is displayed to a user is no longer accurate - I think we should probably update the template at the same time so that the "from" shows where the email will actually come from.

@stesi561
Copy link
Contributor

stesi561 commented May 9, 2018

I assume grabbing the default that would apply for non events/contribution pages is a sensible option so would be something like:

if (!empty($default['is_email_receipt']) && !empty($default['receipt_from_email'])) {
        $mailParams['email_from'] = $default['receipt_from_email'];
} 
// Addition follows
else {
       $mailParams['email_from'] = $domainDetails['1'];
}

@mattwire mattwire force-pushed the CRM-21574_disable_contact_email_tellafriend branch from a6fca2c to a235933 Compare May 12, 2018 10:51
@mattwire
Copy link
Contributor Author

@stesi561 Thanks for the review. I've pushed an updated patch which should fix the issue you found (and it also adds some other cleanup on that class). If you get a chance would you mind reviewing once again?

@mattwire mattwire force-pushed the CRM-21574_disable_contact_email_tellafriend branch from a235933 to d73f038 Compare May 18, 2018 21:41
@mattwire mattwire force-pushed the CRM-21574_disable_contact_email_tellafriend branch from d73f038 to 95e76d7 Compare June 26, 2018 20:35
@eileenmcnaughton
Copy link
Contributor

@mattwire clean up PR merged now - closing this - please re-open / open anew when rebased etc

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.

4 participants