function generateMsgAndSendUsMail($pjnames, $userid, $projUniqId, $comp) { $User_id = $this->Auth->user('id'); $this->loadModel('User'); $rec = $this->User->findById($User_id); $from_name = $rec['User']['name'] . ' ' . $rec['User']['last_name']; App::import('helper', 'Casequery'); $csQuery = new CasequeryHelper(new View(null)); App::import('helper', 'Format'); $frmtHlpr = new FormatHelper(new View(null)); ##### get User Details $toUsrArr = $csQuery->getUserDtls($userid); $to = ""; $to_name = ""; if (count($toUsrArr)) { $to = $toUsrArr['User']['email']; $to_name = $frmtHlpr->formatText($toUsrArr['User']['name']); } $multiple = 0; if (stristr($pjnames, ",")) { $multiple = 1; $subject = "You have been added to multiple projects on Orangescrum"; } else { $subject = "You have been added to " . $pjnames . " on Orangescrum"; } $this->Email->delivery = EMAIL_DELIVERY; $this->Email->to = $to; $this->Email->subject = $subject; $this->Email->from = FROM_EMAIL_NOTIFY; $this->Email->template = 'project_add'; $this->Email->sendAs = 'html'; $this->set('to_name', $to_name); $this->set('projName', $pjnames); $this->set('projUniqId', $projUniqId); $this->set('multiple', $multiple); $this->set('company_name', $comp['Company']['name']); $this->set('from_name', $from_name); return $this->Sendgrid->sendgridsmtp($this->Email); }
function generateMsgAndSendPjMail($pjid, $id, $comp) { $User_id = $this->Auth->user('id'); $this->loadModel('User'); $rec = $this->User->findById($User_id); $from_name = $rec['User']['name'] . ' ' . $rec['User']['last_name']; App::import('helper', 'Casequery'); $csQuery = new CasequeryHelper(new View(null)); App::import('helper', 'Format'); $frmtHlpr = new FormatHelper(new View(null)); ##### get User Details $this->loadModel('User'); $toUsrArr = $this->User->findById($id); $to_email = ""; $to_name = ""; if (count($toUsrArr)) { $to_email = $toUsrArr['User']['email']; $to_name = $frmtHlpr->formatText($toUsrArr['User']['name']); } ##### get Project Details $this->Project->recursive = -1; $prjArr = $this->Project->find('first', array('conditions' => array('Project.id' => $pjid), 'fields' => array('Project.name', 'Project.short_name', 'Project.uniq_id'))); $projName = ""; $projUniqId = ""; if (count($prjArr)) { $projName = $frmtHlpr->formatText($prjArr['Project']['name']); $projUniqId = $prjArr['Project']['uniq_id']; } $subject = "You have been added to " . $projName . " on Scrumptious"; $this->Email->delivery = EMAIL_DELIVERY; $this->Email->to = $to_email; $this->Email->subject = $subject; $this->Email->from = FROM_EMAIL_NOTIFY; $this->Email->template = 'project_add'; $this->Email->sendAs = 'html'; $this->set('to_name', $to_name); $this->set('from_name', $from_name); $this->set('projName', $projName); $this->set('projUniqId', $projUniqId); $this->set('multiple', 0); $this->set('company_name', $comp['Company']['name']); return $this->Sendgrid->sendgridsmtp($this->Email); }
function dailyMail($user = NULL, $project = NULL, $date = NULL) { $from = FROM_EMAIL_NOTIFY; $to = $user['email']; App::import('helper', 'Format'); $frmtHlpr = new FormatHelper(new View(null)); $fromname = $frmtHlpr->formatText(trim($user['name'] . " " . $user['last_name'])); $subject = ucfirst($project['name']) . " (" . strtoupper($project['short_name']) . ") Daily Catch-Up - " . $date; $message = "<table><tr><td><table cellpadding='0' cellspacing='0' align='left' border='0' style='border-collapse:collapse;border-spacing:0;text-align:left;width:600px;border:1px solid #5191BD'>\n<tr style='background:#5191BD;height:50px;'>\n<td style='font:bold 14px Arial;padding:10px;color:#FFFFFF;'>\n<span style='font-size:18px;'>Orangescrum</span> - Daily Catch-Up Alert\n</td>\n</tr>\n<tr>\n<td align='left' style='font:14px Arial;padding:10px;'>\nHi " . ucfirst(trim($user['name'])) . ",\n</td>\n</tr>\n<tr>\n<td style='font:14px Arial;padding:10px;'>\nThis is a reminder to post your today's updates to Orangescrum. Just reply to this email with the updates, it will be added to the project.\n<br/><br/><br/><b>NOTE:</b> DO NOT change the SUBJECT while replying.<br/><br/>\n</td>\n</tr>\n<tr>\n<td align='left' style='font:14px Arial;padding:15px 10px;border-top:1px solid #E1E1E1'>\nThanks,<br/>\nTeam Orangescrum\n</td>\t \n</tr>\n</table></td></tr>\n<tr><td>\n<table style='margin-top:5px;width:600px;'>\n<tr><td style='font:13px Arial;color:#737373;'>Don't want these emails? To unsubscribe, please contact your account administrator to turn off <b>Daily Catch-Up</b> alert for you.</td></tr>\n</table></td></tr>\n"; return $this->Sendgrid->sendGridEmail($from, $to, $subject, $message, '', $fromname); }