? ? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
18 May 2017

Pull Request for Issue #16093 .

Summary of Changes

Dont error if there is no from EMAIL in Joomla Global Config, when sending an email.

Testing Instructions

install Joomla 3.7.1
REMOVE the from name in your global configuration mail settings
Create a new Publisher using the admin console.

Expected result

No email is sent, no PHP warning given.

Actual result

0 Call to a member function addRecipient() on boolean

After applying this patch

screen shot 2017-05-18 at 13 09 33

Documentation Changes Required

(Note: PR quickly created in Github, may need refining)

avatar PhilETaylor PhilETaylor - open - 18 May 2017
avatar PhilETaylor PhilETaylor - change - 18 May 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 May 2017
Category Front End Plugins
avatar PhilETaylor PhilETaylor - change - 18 May 2017
The description was changed
avatar PhilETaylor PhilETaylor - edited - 18 May 2017
avatar PhilETaylor PhilETaylor - change - 18 May 2017
Title
Do not attempt to send email when no from name set
Do not attempt to send email when no from email set
avatar PhilETaylor PhilETaylor - edited - 18 May 2017
avatar PhilETaylor PhilETaylor - change - 18 May 2017
The description was changed
avatar PhilETaylor PhilETaylor - edited - 18 May 2017
avatar mbabker
mbabker - comment - 18 May 2017

Still doesn't fully fix it. If PHPMailer rejects the from or recipient addresses and returns a boolean false, it'll break the fluent interface.

avatar PhilETaylor
PhilETaylor - comment - 18 May 2017

It fixes the reported issue, which is where there is no Mail From email address set in Joomla Global Config.

It doesn't attempt to fix the issues you are reporting ;-)

avatar PhilETaylor
PhilETaylor - comment - 18 May 2017

Are you advocating removing the "sexy way" of chaining the method calls when using phpMailer then?

avatar mbabker
mbabker - comment - 18 May 2017

It's twofold. You fix an obvious "if this field doesn't have an @ symbol then it's totally broken and can't work" issue. But if the supplied email address values fail PHPMailer's validation when adding addresses, then it will still break because setSender and addRecipient can both return either $this or boolean false, the latter breaking the fluent interface.

So ya, you'd have to drop the "sexy" method chaining here.

avatar PhilETaylor
PhilETaylor - comment - 18 May 2017

ok thats an "in the office job" and not "in the hotel lobby drinking coffee" job :)

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 18 May 2017

I have tested this item successfully on 4f1e902


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16107.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 18 May 2017 - Tested successfully
avatar PhilETaylor
PhilETaylor - comment - 18 May 2017

No point testing @franz-wohlkoenig Im gonna improve this when I get to the office.

avatar PhilETaylor PhilETaylor - change - 19 May 2017
Labels Added: ?
avatar PhilETaylor
PhilETaylor - comment - 19 May 2017

I have now removed the fluent interface use of phpMailer calls, please test again.

avatar PhilETaylor PhilETaylor - change - 19 May 2017
The description was changed
avatar PhilETaylor PhilETaylor - edited - 19 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 19 May 2017
Title
Do not attempt to send email when no "From Email" set
Do not attempt to send email when no from email set
avatar joomla-cms-bot joomla-cms-bot - edited - 19 May 2017
avatar PhilETaylor
PhilETaylor - comment - 19 May 2017

@Flowman @joo7 @sharphosting Please test this PR as you reported in #16093

avatar franz-wohlkoenig franz-wohlkoenig - change - 20 May 2017
Title
Do not attempt to send email when no from email set
Do not attempt to send email when no "From Email" set
Easy No Yes
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 May 2017
Title
Do not attempt to send email when no from email set
Do not attempt to send email when no "From Email" set
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 May 2017

@PhilETaylor got different Info than before:
bildschirmfoto 2017-05-20 um 12 25 39
if this is correct, i set "sucessfully Test".

avatar brianteeman
brianteeman - comment - 22 May 2017

I can confirm the issue before the pr
but after applying the pr I just get the message user successfully saved - no warning or error
screen shot 2017-05-22 at 18 16 29


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16107.

avatar brianteeman
brianteeman - comment - 22 May 2017

I have tested this item ? unsuccessfully on d861f6c


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16107.

avatar brianteeman brianteeman - test_item - 22 May 2017 - Tested unsuccessfully
avatar PhilETaylor
PhilETaylor - comment - 22 May 2017

thats the joy with php mail, it provides no feedback…

On 22 May 2017, at 19:16, Brian Teeman notifications@github.com wrote:

I have tested this item ? unsuccessfully on d861f6c d861f6c
This comment was created with the J!Tracker Application https://github.com/joomla/jissues at issues.joomla.org/tracker/joomla-cms/16107 https://issues.joomla.org/tracker/joomla-cms/16107.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #16107 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AAYa3HChRUrciKv6YLnGzvJKgqOZZjJ4ks5r8dEOgaJpZM4NfIBi.

avatar brianteeman
brianteeman - comment - 22 May 2017

i think i would prefer the ugly error message then from before the pr in that case. at least i know something has gone wrong then


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16107.

avatar mbabker
mbabker - comment - 22 May 2017

You can check if setSender and addRecipient return a boolean false instead of ignoring the return in those cases. In theory, https://github.com/joomla/joomla-cms/pull/16107/files#diff-8b42e55d5e424b7f172d227f1a012e1dR167 should be reporting a sending failure but it might have to become a if ($mail->Send() !== true) check (because IIRC that method can return boolean true, boolean false, or JException).

avatar PhilETaylor
PhilETaylor - comment - 23 May 2017

I have now reworked this PR, cleaned up some nested if statements and implemented the suggestions.

Testing instructions:

  1. Go to Joomla Global Config, remove your From Email Address, save config
  2. Go to User Manager, create a NEW user with level "Publisher"
  3. Save and Close this user - see the message

screen shot 2017-05-23 at 10 31 45

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 May 2017

I have tested this item successfully on 64cf52a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16107.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 23 May 2017 - Tested successfully
avatar PhilETaylor
PhilETaylor - comment - 23 May 2017

@Quy Ive reset those braces, darn IDE :)

avatar Quy
Quy - comment - 24 May 2017

There is a similar pr #13518, Maybe it will you some insights to incorporate techniques if any such as try/catch and send().

avatar PhilETaylor
PhilETaylor - comment - 24 May 2017

I have changed this PR so that we use JFactory::getMailer()->sendMail() function instead, this handles all the if statements already and so no need to repeat them, just consume the API.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 May 2017

@PhilETaylor need to test again?

avatar PhilETaylor
PhilETaylor - comment - 24 May 2017

Yes Please.

avatar brianteeman
brianteeman - comment - 24 May 2017

yes you need to test again as the code has changed

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 May 2017

I have tested this item successfully on 3c49f1f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16107.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 24 May 2017 - Tested successfully
avatar Quy
Quy - comment - 24 May 2017

I have tested this item successfully on 3c49f1f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16107.

avatar Quy Quy - test_item - 24 May 2017 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 24 May 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 May 2017

RTC after two successful tests.

avatar rdeutz rdeutz - change - 24 May 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-05-24 20:12:49
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 24 May 2017
avatar rdeutz rdeutz - merge - 24 May 2017

Add a Comment

Login with GitHub to post a comment