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

[CMKC] Email Audits for Review #1724

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions core/components/com_groups/helpers/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,11 @@ public static function sendApproveNotification($type, $object)
$message = new \Hubzero\Mail\Message();

// build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($approvers)
->setTo($from['email'])
->setBcc($approvers)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', $type . '_approval')
Expand Down Expand Up @@ -392,9 +394,11 @@ public static function sendApprovedNotification($type, $object)
$message = new \Hubzero\Mail\Message();

// build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($managers)
->setTo($from['email'])
->setBcc($managers)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', $type . '_approved')
Expand Down
8 changes: 6 additions & 2 deletions core/components/com_groups/site/controllers/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,11 @@ public function saveTask()
$message = new \Hubzero\Mail\Message();

// Build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($emailadmin)
->setTo($from['email'])
->setBcc($emailadmin)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', 'group_pending_approval')
Expand Down Expand Up @@ -1142,9 +1144,11 @@ public function doDeleteTask()
$message = new \Hubzero\Mail\Message();

// Build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($groupMembers)
->setTo($from['email'])
->setBcc($groupMembers)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', 'group_deleted')
Expand Down
16 changes: 12 additions & 4 deletions core/components/com_groups/site/controllers/membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,11 @@ public function doinviteTask()
$message = new \Hubzero\Mail\Message();

// build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($groupInvitees)
->setTo($from['email'])
->setBcc($groupInvitees)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', 'group_invite')
Expand Down Expand Up @@ -493,9 +495,11 @@ public function doinviteTask()
$message = new \Hubzero\Mail\Message();

// build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo(array($mbr['email']))
->setTo($from['email'])
->setBcc(array($mbr['email']))
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', 'group_inviteemail')
Expand Down Expand Up @@ -742,9 +746,11 @@ public function acceptTask()
$message = new \Hubzero\Mail\Message();

// build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($managers)
->setTo($from['email'])
->setBcc($managers)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', 'group_invite_accepted')
Expand Down Expand Up @@ -1181,9 +1187,11 @@ public function dorequestTask()
$message = new \Hubzero\Mail\Message();

// build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($managers)
->setTo($from['email'])
->setBcc($managers)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', 'group_membership_requested')
Expand Down
4 changes: 3 additions & 1 deletion core/components/com_members/admin/controllers/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ public function sendTask()
}
else
{
$mailer->setTo($rows);
// Protection from data breach, list of users are sent bcc
$mailer->setTo(Config::get('mailfrom'));
$mailer->setBcc($rows);
}

// Send the Mail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,8 @@ private function _send($newsletter, $newsletterHtmlContent, $newsletterPlainCont

// build message object and send
$message->setSubject('[SENDING TEST] - '.$mailSubject)
->setTo($contact)
->setTo($mailFrom)
->setBcc($contact)
->addPart($mailHtmlBody, 'text/html')
->addPart($mailPlainBody, 'text/plain')
->send();
Expand Down
3 changes: 2 additions & 1 deletion core/components/com_newsletter/helpers/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ public static function sendMailinglistConfirmationEmail($emailAddress, $mailingl
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setReplyTo($replyto['email'], $replyto['name'])
->setTo($emailAddress)
->setTo($from['email'])
->setBcc($emailAddress)
->addHeader('X-Mailer', 'PHP/' . phpversion())
->addHeader('X-Component', 'com_newsletter')
->addHeader('X-Component-Object', 'Mailinglist')
Expand Down
4 changes: 3 additions & 1 deletion core/components/com_resources/site/controllers/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,9 @@ public function submitTask()
if (\Hubzero\Utility\Validate::email($def))
{
// Send e-mail
$message->setTo(array($def));
// Protection from data breach, list of users are sent bcc
$message->setTo(Config::get('mailfrom'));
$message->setBcc(array($def));
$message->send();
}
}
Expand Down
4 changes: 3 additions & 1 deletion core/components/com_support/admin/controllers/tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,9 @@ public function saveTask()
if (Validate::email($def))
{
// Send e-mail
$msg->setTo(array($def));
// Updated to have protection from data breach, list of users are sent bcc
$msg->setTo(Config::get('mailfrom'));
$msg->setBcc(array($def));
$msg->send();
}
}
Expand Down
4 changes: 3 additions & 1 deletion core/components/com_support/site/controllers/tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,9 @@ public function saveTask()
if (Validate::email($def))
{
// Send e-mail
$message->setTo(array($def));
// Updated to have protection from data breach, list of users are sent bcc
$message->setTo(Config::get('mailfrom'));
$message->setBcc(array($def));
$message->send();
}
}
Expand Down
5 changes: 4 additions & 1 deletion core/plugins/cron/newsletter/newsletter.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ public function processMailings(\Components\Cron\Models\Job $job)
if (preg_match("/\\\"([^\"]*)\\\"\\s<([^>]*)>/ux", $parts[1], $matches))
{
$message->setFrom(array($matches[2] => $matches[1]));
$message->setTo(array($matches[2] => $matches[1]));
}
break;
case 'Reply-To':
if (preg_match("/\\\"([^\"]*)\\\"\\s<([^>]*)>/ux", $parts[1], $matches))
{
$message->setReplyTo(array($matches[2] => $matches[1]));
$message->setTo(array($matches[2] => $matches[1]));
}
break;
case 'Importance':
Expand All @@ -152,8 +154,9 @@ public function processMailings(\Components\Cron\Models\Job $job)
}

// build message object and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($queuedEmail->subject)
->setTo($queuedEmail->email)
->setBcc($queuedEmail->email)
->setBody($queuedEmail->plain_body, 'text/plain')
->addPart($queuedEmail->html_body, 'text/html');

Expand Down
4 changes: 3 additions & 1 deletion core/plugins/groups/announcements/announcements.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,12 @@ public static function send($announcement, $group)
$message = new Hubzero\Mail\Message();

// Set message details and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addReplyTo($from['email'], $from['name'])
->addFrom($from['email'], $from['name'])
->setTo($email, $name)
->setTo($from['email'])
->setBcc($email, $name)
->addPart($plain, 'text/plain')
->addPart($html, 'text/html')
->send();
Expand Down
4 changes: 3 additions & 1 deletion core/plugins/groups/calendar/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -1925,9 +1925,11 @@ private function _sendEmail($to, $from, $subject, $body)
$message = new \Hubzero\Mail\Message();

// set message details and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($to)
->setTo($from['email'])
->setBcc($to)
->addPart($body, 'text/plain')
->addHeader('X-Component', 'com_groups')
->addHeader('X-Component-Object', 'Group Calendar Event Registration')
Expand Down
8 changes: 6 additions & 2 deletions core/plugins/groups/members/members.php
Original file line number Diff line number Diff line change
Expand Up @@ -1612,9 +1612,11 @@ private function notifyUser($targetuser)
$message = new Hubzero\Mail\Message();

// set message details and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($targetuser->get('email'))
->setTo($from['email'])
->setBcc($targetuser->get('email'))
->addPart($plain, 'text/plain')
->send();
}
Expand Down Expand Up @@ -1662,9 +1664,11 @@ private function notifyEmailInvitedUser($email)
$message = new Hubzero\Mail\Message();

// set message details and send
// Protection from data breach, list of users are sent bcc
$message->setSubject($subject)
->addFrom($from['email'], $from['name'])
->setTo($email)
->setTo($from['email'])
->setBcc($email)
->addPart($plain, 'text/plain')
->send();
}
Expand Down
3 changes: 2 additions & 1 deletion core/plugins/groups/messages/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,10 @@ protected function _send()
->setFrom(array($from['email'] => $from['name']))
->addPart($plain, 'text/plain');

// Protection from data breach, list of users are sent bcc
foreach ($recipients as $email => $name)
{
$message->setTo(array($email => $name))->send();
$message->setTo(array($from['email'] => $from['name']))->setBcc(array($email => $name))->send();
}

// add invite emails if sending to invitees
Expand Down
4 changes: 3 additions & 1 deletion core/plugins/projects/team/team.php
Original file line number Diff line number Diff line change
Expand Up @@ -1374,12 +1374,14 @@ public function sendInviteEmail($uid = 0, $email = '', $code = '', $role = 0, $m
// Send HUB message
$recipient = User::getInstance($uid);

// Protection from data breach, list of users are sent bcc
$email = new \Hubzero\Mail\Message();
$email->setSubject($subject)
->addFrom($from['email'], $from['name'])
->addPart($message['plaintext'], 'text/plain')
->addPart($message['multipart'], 'text/html')
->setTo($recipient->email, $recipient->name);
->setTo($from['email'])
->setBcc($recipient->email, $recipient->name);

if ($email->send())
{
Expand Down