Last modified: 2010-05-15 15:54:47 UTC
I think it would be beneficial to add a hook in UserMailer.php just before email is sent. I know there is the EmailUser hook, but it doesn't allow for extensions to be triggered before enotif emails are sent. I would think a simple hook added to UserMailer::send() would help some extension writers.
Can you please be more specific? Adding hooks without proper use cases is usually a no-go.
Created attachment 5158 [details] Proposed new hook in UserMailer.php Proposed hook, I don't know if this is the exact location it should be or not.
Assigned to brion for yes/no/questions.
I uploaded a copy of UserMailer.php that I have modified to include the hook (I just named it 'BeforeEmailSend'), I am not familiar at all with how new hooks are requested/added. I'm not sure if its a good idea to pass in everything like I have it or just subject and body. The only way right now to modify the email messages that are sent out from enotif is to change 'MediaWiki:Enotif body' which is great, but I have the need to replace the user id with the user's real name which can only be done with an extension and there are no current hooks to accomplish this task. I know there is at least one other extension (http://www.mediawiki.org/wiki/Extension:FormatEmail) that has referenced the desire to edit these emails. Thats basically what has prompted me to request this.
You have not edited the most recent version of this file. Please *always* use the most recent version in the repository when submitting patches[1]. Also, never upload a complete file. Upload a unified diff. I will attach a patch based on what you sumitted. [1] http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/UserMailer.php?view=co
Created attachment 5160 [details] Patch based on previous file submit.
This would trigger on *all* email sends, not just notification emails. * Password resets * Email confirmation mails * User-to-user emails * Anything sent by other extensions The only good use I can think of for a hook in this spot is to provide an alternative email-sending backend, but to be functional it would have to be able to take over from the following code. (Eg, check for a false return code and return a result variable passed back from the hook.) If you want something specifically for modifying notification mails, you presumably want something much more specific. It sounds like what you want is actually to modify the behavior of the MailAddress class such that it'll grab the user's "real name" field instead of the username when constructing the quoted address fields.
Created attachment 5165 [details] Add $wgEnotifUseRealName Implement Brion's suggestion above. Allow sending the e-mails with the user's real name as opposed to their username. Also possibly fixes bug 9607.
Keywords: patch, need-review
Patch 5165 applied in r43155. Does this satisfy the requirement laid out in the original request? If so, please mark this bug FIXED.
(In reply to comment #10) > Patch 5165 applied in r43155. Does this satisfy the requirement laid out in the > original request? If so, please mark this bug FIXED. > Looks like it was fine; marking as FIXED.
*** Bug 9607 has been marked as a duplicate of this bug. ***