Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9cea6cd
Converting mail from updatenotification to mail template
Hackwar Apr 16, 2020
4c66170
Converting contact form to mail templates
Hackwar Apr 17, 2020
2038846
Converting com_contact API controller to Mailtemplates
Hackwar Apr 17, 2020
c5d168b
Converting Massmailer mail to mail templates
Hackwar Apr 17, 2020
84c9463
Converting new user mail from plg_user_joomla to mail templates
Hackwar Apr 17, 2020
7ad2a42
Converting password reset mail to mail templates
Hackwar Apr 17, 2020
f4df2b1
Converting com_users remind mail to mail templates
Hackwar Apr 18, 2020
7d56d8f
Codestyle
Hackwar Apr 18, 2020
d10fe21
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
Hackwar Apr 18, 2020
db33d18
Fix update sql for new mail templates
richard67 Apr 26, 2020
a47ee2c
Merge pull request #40 from richard67/4.0-dev-Hackwar-j4mails-mod-1
Hackwar Apr 26, 2020
e710ca2
Replace dots by underscores in mail termplate sub_id
richard67 Apr 26, 2020
2673ccb
Add missing language strings for com_contact
richard67 Apr 26, 2020
bba2450
Add missing language strings for com_users
richard67 Apr 26, 2020
ec9be3c
Add missing strings for update notification mail template
richard67 Apr 26, 2020
01d2a9e
Correct user mail descriptions
richard67 Apr 26, 2020
f054a8b
Mode update notification language strings
richard67 Apr 26, 2020
74ad1f0
alpha order language strings
richard67 Apr 26, 2020
a64860c
revert unwanted change
richard67 Apr 26, 2020
9517235
Merge pull request #41 from richard67/4.0-dev-Hackwar-j4mails-mod-2
Hackwar Apr 26, 2020
d54de26
Fixing a few bugs
Hackwar Apr 28, 2020
b29c138
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
Hackwar May 6, 2020
0d4c296
Update plugins/system/updatenotification/updatenotification.php
Hackwar May 21, 2020
8d01652
Reverting removal of mode line
Hackwar May 21, 2020
7da6916
Fix PHP notice "Undefined offset: 0" in Mail Templates
richard67 May 22, 2020
7e27a4b
Quote slash in regular expression
richard67 May 22, 2020
9638a75
Merge pull request #43 from richard67/4.0-dev-Hackwar-j4mails-mod-1
Hackwar May 22, 2020
519fc81
Correct template ID for new user and alpha order mail templates in SQL
richard67 May 24, 2020
2242494
Load the right mail template
richard67 May 24, 2020
597aee2
Merge pull request #44 from richard67/4.0-dev-Hackwar-j4mails-mod-2
Hackwar May 24, 2020
a4de913
Merge branch 'j4mails' of github.com:Hackwar/joomla-cms into j4mails
Hackwar May 25, 2020
944ffd5
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
Hackwar May 25, 2020
1110ca1
Load client language file for com_contact in API submitt contact form
richard67 May 25, 2020
8cf2608
Merge pull request #45 from richard67/4.0-dev-Hackwar-j4mails-mod-3
Hackwar May 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
INSERT INTO `#__mail_templates` (`template_id`, `language`, `subject`, `body`, `htmlbody`, `attachments`, `params`) VALUES
('com_contact.mail', '', 'COM_CONTACT_ENQUIRY_SUBJECT', 'COM_CONTACT_ENQUIRY_TEXT', '', '', '{"tags":["sitename","name","email","subject","body","url","customfields"]}'),
('com_contact.mail.copy', '', 'COM_CONTACT_COPYSUBJECT_OF', 'COM_CONTACT_COPYTEXT_OF', '', '', '{"tags":["sitename","name","email","subject","body","url","customfields"]}'),
('com_users.massmail.mail', '', 'COM_USERS_MASSMAIL_MAIL_SUBJECT', 'COM_USERS_MASSMAIL_MAIL_BODY', '', '', '{"tags":["subject","body","subjectprefix","bodysuffix"]}'),
('com_users.password_reset', '', 'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', 'COM_USERS_EMAIL_PASSWORD_RESET_BODY', '', '', '{"tags":["name","email","sitename","link_text","link_html","token"]}'),
('com_users.reminder', '', 'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', 'COM_USERS_EMAIL_USERNAME_REMINDER_BODY', '', '', '{"tags":["name","username","sitename","email","link_text","link_html"]}'),
('plg_system_updatenotification.mail', '', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'),
('plg_user_joomla.mail', '', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY', '', '', '{"tags":["name","sitename","url","username","password","email"]}');
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
INSERT INTO "#__mail_templates" ("template_id", "language", "subject", "body", "htmlbody", "attachments", "params") VALUES
('com_contact.mail', '', 'COM_CONTACT_ENQUIRY_SUBJECT', 'COM_CONTACT_ENQUIRY_TEXT', '', '', '{"tags":["sitename","name","email","subject","body","url","customfields"]}'),
('com_contact.mail.copy', '', 'COM_CONTACT_COPYSUBJECT_OF', 'COM_CONTACT_COPYTEXT_OF', '', '', '{"tags":["sitename","name","email","subject","body","url","customfields"]}'),
('com_users.massmail.mail', '', 'COM_USERS_MASSMAIL_MAIL_SUBJECT', 'COM_USERS_MASSMAIL_MAIL_BODY', '', '', '{"tags":["subject","body","subjectprefix","bodysuffix"]}'),
('com_users.password_reset', '', 'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', 'COM_USERS_EMAIL_PASSWORD_RESET_BODY', '', '', '{"tags":["name","email","sitename","link_text","link_html","token"]}'),
('com_users.reminder', '', 'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', 'COM_USERS_EMAIL_USERNAME_REMINDER_BODY', '', '', '{"tags":["name","username","sitename","email","link_text","link_html"]}'),
('plg_system_updatenotification.mail', '', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'),
('plg_user_joomla.mail', '', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY', '', '', '{"tags":["name","sitename","url","username","password","email"]}');
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function display($tpl = null)
$fields = array('subject', 'body', 'htmlbody');
$this->templateData = array();
$language = Factory::getLanguage();
$language->load($component, JPATH_SITE, $this->item->language, true);
$language->load($component, JPATH_ADMINISTRATOR, $this->item->language, true);

foreach ($fields as $field)
Expand Down
1 change: 1 addition & 0 deletions administrator/components/com_mails/tmpl/template/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

$input = $app->input;
list($component, $sub_id) = explode('.', $this->master->template_id, 2);
$sub_id = str_replace('.', '_', $sub_id);

$doc->addScriptOptions('com_mails', ['templateData' => $this->templateData]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<tbody>
<?php foreach ($this->items as $i => $item) :
list($component, $sub_id) = explode('.', $item->template_id, 2);
$sub_id = str_replace('.', '_', $sub_id);
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="break-word">
Expand Down
38 changes: 25 additions & 13 deletions administrator/components/com_users/src/Model/MailModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Mail\Exception\MailDisabledException;
use Joomla\CMS\Mail\MailTemplate;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\Database\ParameterType;
use PHPMailer\PHPMailer\Exception as phpMailerException;
Expand Down Expand Up @@ -97,11 +98,12 @@ protected function preprocessForm(Form $form, $data, $group = 'user')
*/
public function send()
{
$app = Factory::getApplication();
$data = $app->input->post->get('jform', array(), 'array');
$user = Factory::getUser();
$access = new Access;
$db = $this->getDbo();
$app = Factory::getApplication();
$data = $app->input->post->get('jform', array(), 'array');
$user = Factory::getUser();
$access = new Access;
$db = $this->getDbo();
$language = Factory::getLanguage();

$mode = array_key_exists('mode', $data) ? (int) $data['mode'] : 0;
$subject = array_key_exists('subject', $data) ? $data['subject'] : '';
Expand Down Expand Up @@ -176,30 +178,40 @@ public function send()
}

// Get the Mailer
$mailer = Factory::getMailer();
$mailer = new MailTemplate('com_users.massmail.mail', $language->getTag());
$params = ComponentHelper::getParams('com_users');

try
{
// Build email message format.
$mailer->setSender(array($app->get('mailfrom'), $app->get('fromname')));
$mailer->setSubject($params->get('mailSubjectPrefix') . stripslashes($subject));
$mailer->setBody($message_body . $params->get('mailBodySuffix'));
$mailer->IsHtml($mode);
$data = [
'subject' => stripslashes($subject),
'body' => $message_body,
'subjectprefix' => $params->get('mailSubjectPrefix', ''),
'bodysuffix' => $params->get('mailBodySuffix', '')
];
$mailer->addTemplateData($data);

// Add recipients
if ($bcc)
{
$mailer->addBcc($rows);
foreach ($rows as $row)
{
$mailer->addRecipient($row, null, 'bcc');
}

$mailer->addRecipient($app->get('mailfrom'));
}
else
{
$mailer->addRecipient($rows);
foreach ($rows as $row)
{
$mailer->addRecipient($row);
}
}

// Send the Mail
$rs = $mailer->Send();
$rs = $mailer->send();
}
catch (MailDisabledException | phpMailerException $exception)
{
Expand Down
4 changes: 4 additions & 0 deletions administrator/language/en-GB/com_contact.ini
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ COM_CONTACT_HEADING_ASSOCIATION="Association"
COM_CONTACT_ICONS_SETTINGS="Icons"
COM_CONTACT_ID_LABEL="ID"
COM_CONTACT_MAIL_FIELDSET_LABEL="Mail Options"
COM_CONTACT_MAIL_MAIL_COPY_DESC="This mail is sent to the submitter of a mail with the contact form if option \"Send Copy to Submitter\" is switched on in the form settings."
COM_CONTACT_MAIL_MAIL_COPY_TITLE="Contacts: Contact Form Mail Copy"
COM_CONTACT_MAIL_MAIL_DESC="This mail is sent with the contact form."
COM_CONTACT_MAIL_MAIL_TITLE="Contacts: Contact Form Mail"
COM_CONTACT_MANAGER_CONTACTS="Contacts"
COM_CONTACT_MANAGER_CONTACT_EDIT="Contacts: Edit"
COM_CONTACT_MANAGER_CONTACT_NEW="Contacts: New"
Expand Down
8 changes: 8 additions & 0 deletions administrator/language/en-GB/com_users.ini
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,23 @@ COM_USERS_MAIL_FIELD_SEND_AS_BLIND_CARBON_COPY_LABEL="Recipients as BCC"
COM_USERS_MAIL_FIELD_SEND_IN_HTML_MODE_LABEL="Send in HTML Mode"
COM_USERS_MAIL_FIELD_SUBJECT_LABEL="Subject"
COM_USERS_MAIL_FIELD_VALUE_ALL_USERS_GROUPS="All Users Groups"
COM_USERS_MAIL_MASSMAIL_MAIL_DESC="This mail is sent with the \"Mass Mail Users\" form in backend."
COM_USERS_MAIL_MASSMAIL_MAIL_TITLE="Users: Mass Mail Users"
COM_USERS_MAIL_NO_USERS_COULD_BE_FOUND_IN_THIS_GROUP="No users could be found in this group."
COM_USERS_MAIL_ONLY_YOU_COULD_BE_FOUND_IN_THIS_GROUP="You are the only user in this group."
COM_USERS_MAIL_PASSWORD_RESET_DESC="This mail is sent to a user by using the \"Forgot your password?\" link e.g. in a login form."
COM_USERS_MAIL_PASSWORD_RESET_TITLE="Users: Password Reset"
COM_USERS_MAIL_PLEASE_FILL_IN_THE_FORM_CORRECTLY="Please fill in the form correctly."
COM_USERS_MAIL_PLEASE_FILL_IN_THE_MESSAGE="Please enter a message"
COM_USERS_MAIL_PLEASE_FILL_IN_THE_SUBJECT="Please enter a subject"
COM_USERS_MAIL_PLEASE_SELECT_A_GROUP="Please select a Group"
COM_USERS_MAIL_REMINDER_DESC="This mail is sent to a user when by the \"Forgot your username?\" link e.g. in a login form."
COM_USERS_MAIL_REMINDER_TITLE="Users: Username Reminder"
COM_USERS_MAIL_THE_MAIL_COULD_NOT_BE_SENT="The mail could not be sent."
COM_USERS_MASS_MAIL="Mass Mail Users"
COM_USERS_MASS_MAIL_DESC="Mass Mail options."
COM_USERS_MASSMAIL_MAIL_BODY="{BODY} {BODYSUFFIX}"
COM_USERS_MASSMAIL_MAIL_SUBJECT="{SUBJECTPREFIX} {SUBJECT}"
COM_USERS_MSG_NOT_ENOUGH_INTEGERS_N="Password does not have enough digits. At least %s digits are required."
COM_USERS_MSG_NOT_ENOUGH_INTEGERS_N_1="Password does not have enough digits. At least 1 digit is required."
COM_USERS_MSG_NOT_ENOUGH_LOWERCASE_LETTERS_N="Password does not have enough lower case characters. At least %s lower case characters are required."
Expand Down
14 changes: 4 additions & 10 deletions administrator/language/en-GB/plg_system_updatenotification.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
PLG_SYSTEM_UPDATENOTIFICATION="System - Joomla! Update Notification"
PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_LBL="Super User Emails"
PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_DESC="A comma separated list of the email addresses which will receive the update notification emails. The addresses in the list MUST belong to existing users of your site who have the Super User privilege. If none of the listed emails belongs to Super Users, or if it's left blank, all Super Users of this site will receive the update notification email."
; You can use the following merge codes:
; [NEWVERSION] New Joomla! version, e.g. 1.2.3
; [CURVERSION] Currently installed Joomla! version, e.g. 1.2.0
; [SITENAME] Site name, as set in Global Configuration.
; [URL] URL of the site's frontend page.
; [LINK] Update URL (link to com_joomlaupdate, will request login if the Super User isn't already logged in).
; [RELEASENEWS] URL to the release news on joomla.org
; \n Newline character. Use it to start a new line in the email.
PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_SUBJECT="Joomla! Update available for [SITENAME] – [URL]"
PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by Joomla.org. It is sent automatically by your own site,\n[SITENAME] - [URL] \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available for download.\n\nJoomla! version currently installed: [CURVERSION]\nJoomla! version available for installation: [NEWVERSION]\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on [SITENAME] please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: [LINK]\n\nRelease News can be found here: [RELEASENEWS]\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'System - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, [SITENAME]"
PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_SUBJECT="Joomla! Update available for {SITENAME} – {URL}"
PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by Joomla.org. It is sent automatically by your own site,\n{SITENAME} - {URL} \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available for download.\n\nJoomla! version currently installed: {CURVERSION}\nJoomla! version available for installation: {NEWVERSION}\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on {SITENAME} please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: {LINK}\n\nRelease News can be found here: {RELEASENEWS}\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'System - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, {SITENAME}"
PLG_SYSTEM_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_LBL="Email Language"
PLG_SYSTEM_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_DESC="Select a language for the update notification emails. Set to Auto to send them in the site language at the time."
PLG_SYSTEM_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_NONE="Auto"
PLG_SYSTEM_UPDATENOTIFICATION_MAIL_MAIL_DESC="This mail is sent to the site administrator when the \"Joomla! Update Notification\" system plugin has detected an available update."
PLG_SYSTEM_UPDATENOTIFICATION_MAIL_MAIL_TITLE="Joomla: Update Notification"
PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME="The Joomla! Update Notification will not run in this configuration"
PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY="In your Installer Configuration you have set the Option Update Cache (in Hours) to 0 this means that Joomla is not caching the Update. This means an email should be sent on every page visit but this is not possible. Please increase the value (6 is default) or confirm that the Joomla! Update Notification will never send you mails."
PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION="Set it back to the default setting (6 Hours)"
Expand Down
4 changes: 3 additions & 1 deletion administrator/language/en-GB/plg_user_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ PLG_USER_JOOMLA_FIELD_AUTOREGISTER_LABEL="Auto-create Users"
PLG_USER_JOOMLA_FIELD_FORCELOGOUT_LABEL="Force Logout for all Sessions?"
PLG_USER_JOOMLA_FIELD_MAILTOUSER_LABEL="Notification Mail to User"
PLG_USER_JOOMLA_FIELD_STRONG_PASSWORDS_LABEL="Strong Passwords"
PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY="Hello %s,\n\n\nYou have been added as a User to %s by an Administrator.\n\nThis email has your username and password to log in to %s\n\nUsername: %s\nPassword: %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only."
PLG_USER_JOOMLA_MAIL_MAIL_DESC="This mail is sent to a new user who has just been created in backend."
PLG_USER_JOOMLA_MAIL_MAIL_TITLE="Users: New User"
PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY="Hello {NAME},\n\n\nYou have been added as a User to {SITENAME} by an Administrator.\n\nThis email has your username and password to log in to {URL}\n\nUsername: {USERNAME}\nPassword: {PASSWORD}\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only."
PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT="New User Details"
PLG_USER_JOOMLA_POSTINSTALL_STRONGPW_BTN="Enable Strong Password Encryption"
PLG_USER_JOOMLA_POSTINSTALL_STRONGPW_TEXT="As a security feature, Joomla allows you to switch to strong password encryption.<br>To turn strong passwords on select the button below. Alternatively you can edit the User - Joomla plugin and change the strong password setting to On.<br>Before enabling you should verify that all third party registration/login, user management or bridge extensions installed on your site support this strong password encryption."
Expand Down
Loading