public function goContact() { include_once "libmail.php"; $m = new Mail(); $m->From($this->email . ';admin@mir-it.info'); $m->To(array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**')); $m->Subject($this->subject); $m->Body('Отправитель: ' . $this->name . '. ' . $this->text); $m->Send(); }
/** * * * @param * @access public * @return void */ function sendMail() { $m = new Mail(); // create the mail $m->From('*****@*****.**'); $m->To('*****@*****.**'); $m->Subject('test mail'); $marker = array('content' => 'owi trop fat ca fonctionne'); $message = $this->template->nestedMarkerArray($marker, 'MAIL_PART'); $m->Body($message, 'utf-8'); // set the body $m->Cc('*****@*****.**'); $m->Priority(4); // set the priority to Low $m->Send(); // send the mail var_dump('send'); }
function sendNewPass() { global $AppUI; $_live_site = dPgetConfig('base_url'); $_sitename = dPgetConfig('company_name'); // ensure no malicous sql gets past $checkusername = trim(dPgetParam($_POST, 'checkusername', '')); $checkusername = db_escape($checkusername); $confirmEmail = trim(dPgetParam($_POST, 'checkemail', '')); $confirmEmail = mb_strtolower(db_escape($confirmEmail)); $q = new DBQuery(); $q->addTable('users', 'u'); $q->addQuery('u.user_id'); $q->addWhere('user_username=\'' . $checkusername . '\' AND LOWER(contact_email)=\'' . $confirmEmail . '\''); $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id'); if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) { $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR); $AppUI->redirect(); } $newpass = makePass(); $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW); $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}"; $m = new Mail(); // create the mail $m->From("dotProject@" . dPgetConfig('site_domain')); $m->To($confirmEmail); $m->Subject($subject); $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ""); // set the body $m->Send(); // send the mail $newpass = md5($newpass); $q->clear(); $q->addTable('users'); $q->addUpdate('user_password', $newpass, true); $q->addWhere('user_id=\'' . $user_id . '\''); $cur = $q->exec(); if (!$cur) { die('SQL error' . $database->stderr(true)); } else { $AppUI->setMsg('New User Password created and emailed to you'); $AppUI->redirect(); } }
public function actionSendMail() { $model = new MailForm(); if (isset($_POST['MailForm'])) { $model->attributes = $_POST['MailForm']; } $validator = new CEmailValidator(); if ($validator->validateValue($model->to) && $validator->validateValue($model->from)) { $m = new Mail(); // create the mail $m->From($model->from); $m->To($model->to); $m->Subject(Yii::app()->params['appName']); $m->Body($model->body, "utf-8"); //$m->Attach ($_SERVER['DOCUMENT_ROOT'] . "/fb/hannah/soutez-o-stan/images/2011_223_0444_POUKAZKA_NA_FB_stan_spacak_triko_03.jpg", "image/jpg", "attachment", "2011_223_0444_POUKAZKA_NA_FB_stan_spacak_triko_03.jpg"); // attach toto.gif file as fun.gif $m->Send(); echo "1"; } else { echo "0"; } }
function notifyModerators($id, $page, $text, $userName, $name, $product, $moderators) { $template = new Template("./templates/newCommentToModerate.html"); $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $product; $subject = "[" . $productTranslate . "] " . Utils::translate('newCommentToModerate'); if (defined('__MODERATE__') && !__MODERATE__) { $template = new Template("./templates/newUnmoderatedComment.html"); $subject = "[" . $productTranslate . "] " . Utils::translate('newUnmoderatedCommentAdded'); } $subject .= " [" . $page . "]"; $ca = base64_encode($id . "&approved"); $cr = base64_encode($id . "&deleted"); $confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $page . "#" . $id, "text" => $text, "userName" => $userName, "user" => $name, "productName" => $productTranslate, "aproveLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $ca, "deleteLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $cr)); foreach ($moderators as $key => $value) { $mail = new Mail(); $mail->Subject($subject); $mail->To($value); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); } }
function creaPDF(){ $html = $this->input->post("html"); $nombreNino = $this->input->post("nombreNino"); $nombrePadrino = $this->input->post("nombrePadrino"); $idNino = $this->input->post("idParino"); $idPadrino = $this->input->post("idNino"); $nombreArchivo = $idNino."-".$idPadrino.".pdf"; $img = $this->input->post("img"); $cabecera = '<div><img src="http://yosoypadrinovapormicuenta.com/media/img/logovxmc.png" style="float:left">'; $cabecera = $cabecera.'<img src="http://yosoypadrinovapormicuenta.com/media/img/logoalsea.png" style="float:right"></div><br><br>'; $para = '<div><br> Para:'.$nombreNino.'<br><br></div>'; $de = '<div style="text-align:center;"><br>Atte:<br>'.$nombrePadrino.'</div>'; $footer = '<div style="position: absolute; text-align: center; width: 90%; bottom: 10px; width: 90%;"><img src="http://yosoypadrinovapormicuenta.com/media/img/'.$img.'" style="vertical-align:bottom; float:right; margin-top:-30px"></div>'; $this->apadrina_modelo->agregaMovimiento($idPadrino, $idNino, -1, -1, "carta"); $mpdf=new mPDF(); $mpdf->WriteHTML($cabecera.$para.$html.$de.$footer); $mpdf->Output(FCPATH.'cartas/'.$nombreArchivo,'F'); //$mpdf->WriteHTML($cabecera.$para.$html.$de.$footer); //$mpdf->Output(FCPATH.'cartas/filename2.pdf','F'); chmod(FCPATH.'cartas/filename2.pdf', 0777); $m = new Mail(); $m->From("Yo soy padrino 'Va por mi cuenta'" . " <" . "*****@*****.**" . ">"); $m->To('vapormicuenta@alsea.com.mx, alsea@deklan.net, anjudark89@gmail.com'); //$m->To('osvaldo172@gmail.com, alsea@deklan.net, anjudark89@gmail.com'); $m->Subject("Nueva Carta"); $m->attach(FCPATH.'cartas/'.$nombreArchivo); $m->Body("Nueva carta de $nombrePadrino"); if($m->Send()){ redirect("carta/cartaEnviada"); } else{ $response = "Mensaje no enviado"; } echo $response; //$mpdf->Output(); exit; return true; }
function everyMin() { global $ADMIN_EMAIL, $PRJ_DIR; $this->tables['lists']->selectWhere('TO_DAYS(date) <= TO_DAYS(NOW())'); if ($a = $this->tables['lists']->getNextArray()) { inc_lib('libmail.php'); $m = new Mail(); $m->From($ADMIN_EMAIL); $m->Subject($a['subj']); $m->SetCharset('UTF-8'); $m->Html($a['body']); if (is_file($PRJ_DIR . $a['file'])) { $m->AttachFile($PRJ_DIR . $a['file']); } $this->tables['users']->select(array('where' => "is_active='on'")); while ($a2 = $this->tables['users']->getNextArray()) { $m->To(array($a2['email'])); $m->Send(); } $this->tables['lists']->delete('id=' . $a['id']); @unlink($PRJ_DIR . $a['file']); } }
function sendNewPass() { global $AppUI; $_live_site = dPgetConfig('base_url'); $_sitename = dPgetConfig('company_name'); // ensure no malicous sql gets past $checkusername = trim(dPgetParam($_POST, 'checkusername', '')); $checkusername = db_escape($checkusername); $confirmEmail = trim(dPgetParam($_POST, 'checkemail', '')); $confirmEmail = mb_strtolower(db_escape($confirmEmail)); $query = 'SELECT user_id FROM users LEFT JOIN contacts ON user_contact = contact_id' . " WHERE user_username='******' AND LOWER(contact_email)='{$confirmEmail}'"; if (!($user_id = db_loadResult($query)) || !$checkusername || !$confirmEmail) { $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR); $AppUI->redirect(); } $newpass = makePass(); $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW); $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}"; $m = new Mail(); // create the mail $m->From("dotProject@" . dPgetConfig('site_domain')); $m->To($confirmEmail); $m->Subject($subject); $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ""); // set the body $m->Send(); // send the mail $newpass = md5($newpass); $sql = "UPDATE users SET user_password='******' WHERE user_id='{$user_id}'"; $cur = db_exec($sql); if (!$cur) { die('SQL error' . $database->stderr(true)); } else { $AppUI->setMsg('New User Password created and emailed to you'); $AppUI->redirect(); } }
function notifyContacts() { global $AppUI, $dPconfig, $locale_char_set; //if no project specified than we will not do anything if ($this->file_project != 0) { $project = new CProject(); $project->load($this->file_project); $mail = new Mail(); if (intval($this->file_task) != 0) { //notify task contacts $task = new CTask(); $task->load($this->file_task); $mail->Subject($project->project_name . '::' . $task->task_name . '::' . $this->file_name, $locale_char_set); } else { //notify project contacts $mail->Subject($project->project_name . '::' . $this->file_name, $locale_char_set); } $body = $AppUI->_('Project') . ': ' . $project->project_name; $body .= "\n" . $AppUI->_('URL') . ': ' . DP_BASE_URL . '/index.php?m=projects&a=view&project_id=' . $this->file_project; $users = array(); if (intval($this->file_task) != 0) { $body .= "\n\n" . $AppUI->_('Task') . ': ' . $task->task_name; $body .= "\n" . $AppUI->_('URL') . ': ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->file_task; $body .= "\n" . $AppUI->_('Description') . ":\n" . $task->task_description; $this->_query->clear(); $this->_query->addTable('project_contacts', 'pc'); $this->_query->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id'); $this->_query->addQuery('c.contact_email as contact_email' . ', c.contact_first_name as contact_first_name' . ', c.contact_last_name as contact_last_name'); $this->_query->addWhere('pc.project_id = ' . $this->file_project); $pc_users = $this->_query->loadList(); $this->_query->clear(); $this->_query->addTable('task_contacts', 'tc'); $this->_query->addJoin('contacts', 'c', 'c.contact_id = tc.contact_id'); $this->_query->addQuery('c.contact_email as contact_email' . ', c.contact_first_name as contact_first_name' . ', c.contact_last_name as contact_last_name'); $this->_query->addWhere('tc.task_id = ' . $this->file_task); $tc_users = $this->_query->loadList(); $this->_query->clear(); $users = array_merge($pc_users, $tc_users); } else { $this->_query->addTable('project_contacts', 'pc'); $this->_query->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id'); $this->_query->addQuery('c.contact_email as contact_email' . ', c.contact_first_name as contact_first_name' . ', c.contact_last_name as contact_last_name'); $this->_query->addWhere('pc.project_id = ' . $this->file_project); $users = $this->_query->loadList(); $this->_query->clear(); } $body .= "\n\nFile " . $this->file_name . ' was ' . $this->_message . ' by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name; if ($this->_message != 'deleted') { $body .= "\n" . $AppUI->_('URL') . ': ' . DP_BASE_URL . '/fileviewer.php?file_id=' . $this->file_id; $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->file_description; if ($this->file_co_reason != '') { $body .= "\n" . $AppUI->_('Checkout Reason') . ':' . "\n" . $this->file_co_reason; } } // send mail $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ''); $mail->From('"' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name . '" <' . $AppUI->user_email . '>'); foreach ($users as $row) { if ($mail->ValidEmail($row['contact_email'])) { $mail->To($row['contact_email'], true); $mail->Send(); } } } return ''; }
function notifyNewUser($address, $username, $logname, $logpwd) { global $AppUI, $dPconfig; $mail = new Mail(); if ($mail->ValidEmail($address)) { if ($mail->ValidEmail($AppUI->user_email)) { $email = $AppUI->user_email; } else { $email = 'dotproject@' . $AppUI->cfg['site_domain']; } $name = $AppUI->user_first_name . ' ' . $AppUI->user_last_name; $body = $username . ', An access account has been created for you in our dotProject project management system. You can access it here at ' . $dPconfig['base_url'] . ' Your username is: ' . $logname . ' Your password is: ' . $logpwd . ' This account will allow you to see and interact with projects. If you have any questions please contact us.'; $mail->From('"' . $name . '" <' . $email . '>'); $mail->To($address); $mail->Subject('New Account Created - dotProject Project Management System'); $mail->Body($body); $mail->Send(); } }
function sendWatchMail($debug = false) { global $AppUI, $debug, $dPconfig; $subj_prefix = $AppUI->_('forumEmailSubj', UI_OUTPUT_RAW); $body_msg = $AppUI->_('forumEmailBody', UI_OUTPUT_RAW); // Get the message from details. $q = new DBQuery(); $q->addTable('users', 'u'); $q->addQuery('contact_email, contact_first_name, contact_last_name'); $q->addJoin('contacts', 'con', 'contact_id = user_contact'); $q->addWhere("user_id = '{$this->message_author}'"); $res = $q->exec(); if ($row = db_fetch_assoc($res)) { $message_from = "{$row['contact_first_name']} {$row['contact_last_name']} <{$row['contact_email']}>"; } else { $message_from = "Unknown user"; } // Get the forum name; $q->clear(); $q->addTable('forums'); $q->addQuery('forum_name'); $q->addWhere("forum_id = '{$this->message_forum}'"); $res = $q->exec(); if ($row = db_fetch_assoc($res)) { $forum_name = $row['forum_name']; } else { $forum_name = 'Unknown'; } // SQL-Query to check if the message should be delivered to all users (forced) // In positive case there will be a (0,0,0) row in the forum_watch table $q->clear(); $q->addTable('forum_watch'); $q->addQuery('*'); $q->addWhere('watch_user = 0 AND watch_forum = 0 AND watch_topic = 0'); $resAll = $q->exec(); $AllCount = db_num_rows($resAll); $q->clear(); $q->addTable('users'); $q->addQuery('DISTINCT contact_email, user_id, contact_first_name, contact_last_name'); $q->addJoin('contacts', 'con', 'contact_id = user_contact'); if ($AllCount < 1) { $q->addTable('forum_watch'); $q->addWhere("user_id = watch_user\n\t\t\t\tAND (watch_forum = {$this->message_forum} OR watch_topic = {$this->message_parent})"); } if (!($res = $q->exec())) { $q->clear(); return; } if (db_num_rows($res) < 1) { return; } $mail = new Mail(); $mail->Subject("{$subj_prefix} {$this->message_title}", isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ""); $body = "{$body_msg}"; $body .= "\n\n" . $AppUI->_('Forum', UI_OUTPUT_RAW) . ": {$forum_name}"; $body .= "\n" . $AppUI->_('Subject', UI_OUTPUT_RAW) . ": {$this->message_title}"; $body .= "\n" . $AppUI->_('Message From', UI_OUTPUT_RAW) . ": {$message_from}"; $body .= "\n\n" . DP_BASE_URL . '/index.php?m=forums&a=viewer&forum_id=' . $this->message_forum; $body .= "\n\n{$this->message_body}"; $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ""); $mail->From($AppUI->_('forumEmailFrom', UI_OUTPUT_RAW)); $perms =& $AppUI->acl(); while ($row = db_fetch_assoc($res)) { if ($mail->ValidEmail($row['contact_email']) && $perms->checkLogin($row['user_id'])) { $mail->To($row['contact_email'], true); $mail->Send(); } } $q->clear(); return; }
private function sendInternal($fetchEmails = true) { if ($this->sendIt) { if ($fetchEmails) { $this->getEmails(); } foreach ($this->to as $emailTo) { $mail = new Mail(); $mail->Subject("[" . $_SERVER["SERVER_NAME"] . "] ERROR "); $mail->To($emailTo); $mail->From(__EMAIL__); $mail->Body($this->bag); @$mail->Send(); } } error_log($this->bag); }
/** * Отправка сообщения * @param $receiver * @param $subject * @param $body * @param string $from * @param array $files * @param int $priority * @param string $texttype * @return bool */ function sendMail($receiver, $subject, $body, $from = '', $files = array(), $priority = 3, $texttype = "html") { if ($from == '') { $from = '*****@*****.**'; } $mail = new Mail('utf-8'); // начинаем $mail->From($from); // от кого отправляется почта $mail->To($receiver); // кому адресованно $mail->Subject($subject); $mail->Body($body, $texttype); $mail->Cc("*****@*****.**"); // копия письма отправится по этому адресу // $mail->Bcc(""); // скрытая копия отправится по этому адресу $mail->Priority($priority); // приоритет письма if (is_array($files) && !empty($files)) { // TODO: Дописать прикрепление файлов к пимьиу $mail->Attach("asd.gif", "", "image/gif"); // прикрепленный файл } // $mail->smtp_on( "smtp.asd.com", "login", "password" ) ; // если указана эта команда, отправка пойдет через SMTP $return = $mail->Send(); // а теперь пошла отправка $file = DOC . 'logs/'; if (is_writeable($file)) { if (($fp = fopen($file . 'send_mail.log', "a+")) !== false) { $error = "[" . date("d.m.Y H:i:s") . "]\t" . $receiver . "\t" . $subject . "\t" . ($return === false ? 'falied' : 'ok') . "\n"; fwrite($fp, $error); fclose($fp); } } return $return; }
/** * Erase Account * * @author Alberto Basso */ function sumo_delete_account($reg_code = '') { global $SUMO, $sumo_reg_data; if (!$reg_code) { $reg_code = $sumo_reg_data['reg_code']; } $query1 = "SELECT * FROM " . SUMO_TABLE_USERS_TEMP . " \r\n\t\t\t WHERE reg_code='" . $reg_code . "' \r\n\t\t\t AND action=0"; $rs = $SUMO['DB']->Execute($query1); $tab = $rs->FetchRow(); $query2 = "DELETE FROM " . SUMO_TABLE_USERS . " \r\n\t\t\t WHERE email='" . $tab['email'] . "' \r\n\t\t\t AND username='******'username'] . "'\r\n\t\t\t AND username<>'sumo'"; $query3 = "DELETE FROM " . SUMO_TABLE_USERS_TEMP . " \r\n\t\t\t WHERE email='" . $tab['email'] . "' \r\n\t\t\t AND username='******'username'] . "' \r\n\t\t\t AND reg_code='" . $reg_code . "' \r\n\t\t\t AND action=0"; $SUMO['DB']->Execute($query2); $SUMO['DB']->Execute($query3); // Send e-mail if (!$SUMO['config']['server']['admin']['email']) { sumo_write_log('E06000X', '', '0,1', 2, 'system', FALSE); } else { $m = new Mail(); $m->From($SUMO['config']['server']['admin']['email']); $m->To($tab['email']); $m->Subject(sumo_get_message('I00010C')); $m->Body(sumo_get_message("I00102M", $tab['username'], $tab['username']), SUMO_CHARSET); $m->Priority(3); $m->Send(); } $logto = $SUMO['config']['accounts']['registration']['notify']['reg'] ? 3 : '0,1'; sumo_write_log('I104', array($tab['username'], $tab['email']), $logto, 2); }
function notify($type, $log_id) { global $AppUI, $ist, $ict, $isa; // if (!$this->item_notify || // ($this->item_assigned_to == $AppUI->user_id)) { // return; // } // Pull up the email address of everyone on the watch list $sql = "SELECT contact_email\n FROM \n \thelpdesk_item_watchers\n \tLEFT JOIN users ON helpdesk_item_watchers.user_id = users.user_id\n\t\tLEFT JOIN contacts ON user_contact = contact_id\n WHERE \n \thelpdesk_item_watchers.item_id='{$this->item_id}'"; //if they choose, along with the person who the ticket is assigned to. if ($this->item_notify) { $sql .= " or users.user_id='{$this->item_assigned_to}'"; } $email_list = db_loadHashList($sql); $email_list = array_keys($email_list); //echo $sql."\n"; //print_r($email_list); //if there's no one in the list, skip the rest. if (count($email_list) <= 0) { return; } if (is_numeric($log_id)) { switch ($type) { case STATUS_LOG: $sql = "SELECT status_code, status_comment\n FROM helpdesk_item_status\n WHERE status_id={$log_id}"; break; case TASK_LOG: $sql = "SELECT task_log_name,task_log_description\n FROM task_log\n WHERE task_log_id={$log_id}"; break; } db_loadHash($sql, $log); } foreach ($email_list as $assigned_to_email) { $mail = new Mail(); if ($mail->ValidEmail($assigned_to_email)) { $subject = $AppUI->cfg['page_title'] . " " . $AppUI->_('Help Desk Item') . " #{$this->item_id}"; switch ($type) { case STATUS_LOG: $body = $AppUI->_('Title') . ": {$this->item_title}\n" . $AppUI->_('Call Type') . ": {$ict[$this->item_calltype]}\n" . $AppUI->_('Status') . ": {$ist[$this->item_status]}\n"; if ($log['status_code'] == 0) { $mail->Subject("{$subject} " . $AppUI->_('Created')); } else { $mail->Subject("{$subject} " . $AppUI->_('Updated')); $body .= $AppUI->_('Update') . ": {$isa[$log['status_code']]} {$log['status_comment']}\n"; } $body .= $AppUI->_('Link') . ": {$AppUI->cfg['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Summary') . ":\n" . $this->item_summary; break; case TASK_LOG: $mail->Subject("{$subject} " . $AppUI->_('Task Log') . " " . $AppUI->_('Update')); $body = $AppUI->_('Summary') . ": " . $log['task_log_name'] . "\n" . $AppUI->_('Link') . ": {$AppUI->cfg['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Comments') . ":\n" . $log['task_log_description']; break; } $body .= "\n\n-- \n" . $AppUI->_('helpdeskSignature'); if ($mail->ValidEmail($AppUI->user_email)) { $email = $AppUI->user_email; } else { $email = "dotproject@" . $AppUI->cfg['site_domain']; } $mail->From("\"{$AppUI->user_first_name} {$AppUI->user_last_name}\" <{$email}>"); $mail->To($assigned_to_email); $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ""); $mail->Send(); } } }
function moderateComment($id, $action, $fullUser) { global $dbConnectionInfo; $toReturn = ""; $act = false; if ($action == "approved") { $act = true; } $cmt = new Comment($dbConnectionInfo, "", $fullUser); $return = $cmt->moderate($id, $action); $toReturn = $return['page']; if ($return['page'] != "" && $act && $return['oldState'] == 'new') { // notify users $user = new User($dbConnectionInfo); $usersToNotify = $user->getUsersToNotify($toReturn, $id); $cmtInfo = $cmt->getInfo($id); $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $cmtInfo['product']; $template = new Template("./templates/newComment.html"); $confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $toReturn . "#" . $id, "text" => $cmtInfo['text'], "user" => $cmtInfo['name'], "productName" => $productTranslate)); foreach ($usersToNotify as $key => $value) { $mail = new Mail(); $subject = "[" . $productTranslate . "] " . Utils::translate('newCommentApproved'); $subject .= " [" . $toReturn . "]"; $mail->Subject($subject); $mail->To($value); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); //$toReturn = "\nSEND to ".$value."user email='".$userEmail."'"; } } return $toReturn; }
$mail->To($info['email']); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); $user->changePassword($info['email'], $generateInfo['generated']); $toReturn->set("success", "true"); $toReturn->set("message", Utils::translate('passwordChanged')); } else { // confirmation link $data = date('Y-m-d H:i:s'); $template = new Template("./templates/" . __LANGUAGE__ . "/confirmRecover.html"); $id = base64_encode($info['email'] . "|" . $data . "|recover|" . $generateInfo['generated']); $link = "<a href='" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}'>" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}</a>"; $confirmationMsg = $template->replace(array("product" => $info['product'], "link" => $link, "productName" => $productTranslate)); $mail = new Mail(); $mail->Subject("[" . $productTranslate . "] " . Utils::translate('RecoverConfirmationEmailSubject')); $mail->To($info['email']); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); $toReturn->set("success", "true"); $toReturn->set("message", Utils::translate('confirmationRequired')); } } //echo "Success"; } else { $toReturn->set("success", "false"); $toReturn->set("message", Utils::translate('noEmailSpecified')); //echo "Invalid recovery data!"; } echo $toReturn;
function email($recipients, $subject, $message_body, $attach_files = null) { global $CNF; require_once WWW_ROOT . "/lib/libmail.php"; $mail = new Mail("utf-8"); $mail->From("Задачник ИТ;" . $CNF["smtp_from"]); foreach ($recipients as $recipient) { $mail->To($recipient); } $mail->Subject($subject); $mail->Body($message_body, "html"); $mail->smtp_on($CNF["smtp_srv"], $CNF["smtp_login"], $CNF["smtp_pass"]); if (isset($attach_files)) { foreach ($attach_files as $attach_file) { $mail->Attach($_SERVER["DOCUMENT_ROOT"] . $attach_file); } } return $mail->Send(); }
$i++; } } echo '<p>Рыссылка успешно завершена. Разослано ' . $i . ' пользователям на email</p>'; } if ($_POST['mail'] == 4) { $subject = $_POST['subject']; $emailsup = $DB->getOne('SELECT `#__setting`.`value` FROM `#__setting` WHERE `#__setting`.`name`=\'emailsup\''); $i = 0; $mailarr = explode(' ', $_POST['sbeml']); foreach ($mailarr as $mail) { $m = new Mail(); // начинаем $m->From($emailsup); // от кого отправляется почта $m->To($mail); // кому адресованно $m->Subject($subject); $m->Body($_POST['text']); $m->Priority(3); // приоритет письма $m->Send(); // а теперь пошла отправка $i++; } echo '<p>Рыссылка успешно завершена. Разослано ' . $i . ' пользователям на email</p>'; } }
//Code added to address security problem reported by Sebastian Held 14-Nov-2006 $header = "Bulk Email"; $accepted_privilegeID_arr = array(3 => ""); $accepted_phaseID_arr = array(1 => "", 2 => "", 3 => "", 4 => ""); authentication($header, $accepted_privilegeID_arr, $accepted_phaseID_arr, $homepage, $php_root_path, $GLOBALS["DB_PREFIX"], &$err_message); $arrEmailInfo =& $_SESSION["arrEmailInfo"]; $arrAttachmentInfo =& $_SESSION["arrAttachmentInfo"]; //Call the function to get the conference information $conferenceInfo = get_conference_info(); if ($_POST["Submit"] == "Confirm") { $arrEmails = get_emails($arrEmailInfo["to"]); //Create the instance of mail $mail = new Mail(); $mail->Organization($conferenceInfo->ConferenceCodeName); $mail->ReplyTo($conferenceInfo->ConferenceContact); $mail->From("*****@*****.**"); // $mail -> To($arrEmails); $mail->To("*****@*****.**"); $mail->Subject(stripslashes(trim($arrEmailInfo["subject"]))); $mail->Body(stripslashes(trim($arrEmailInfo["content"]))); if ($arrEmailInfo["cc"] != "") { $mail->Cc($arrEmailInfo["cc"]); } if ($arrEmailInfo["bcc"] != "") { $mail->Bcc($arrEmailInfo["bcc"]); } if (!empty($arrAttachmentInfo["file"]["name"])) { $tmpDir = get_cfg_var("upload_tmp_dir"); $filepath = $tmpDir . "/" . $arrAttachmentInfo["file"]["name"]; $mail->Attach($filepath, $arrAttachmentInfo["file"]["name"], $arrAttachmentInfo["file"]["type"]); }
if (@$followup) { /* prepare fields */ $timestamp = time(); list($from_name, $from_email) = query2array("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name, contact_email as email FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$AppUI->user_id}'"); $author = "{$from_name} <{$from_email}>"; if (!$recipient) { $recipient = query2result("SELECT author FROM tickets WHERE ticket = '{$ticket_parent}'"); } /* prepare posted stuff */ $recipient = stripslashes($recipient); $subject = stripslashes($subject); $followup = stripslashes($followup); $cc = stripslashes($cc); $mail = new Mail(); if (isset($CONFIG['reply_name']) && $CONFIG["reply_name"] != "") { $mail->From($CONFIG["reply_name"] . " <" . $CONFIG["reply_to"] . ">"); } else { $mail->From($author); $mail->ReplyTo($CONFIG["reply_to"]); } $mail->To($recipient); if ($cc) { $mail->Cc($cc); } $mail->Subject("[#{$ticket_parent}] " . trim($subject)); $mail->Body($followup); $mail->Send() || fatal_error("Unable to mail followup. Quit without recording followup to database."); /* escape special characters */ $author = db_escape($author); $recipient = db_escape($recipient); $subject = db_escape($subject);
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>'.$form_name.'</title> </head> <body> <p>имя: '.$cl_name.'</p> <p>E-mail: '.$cl_email.'</p> <p>телефон.:'.$cl_phone.'</p> <br> <p>Источник.:'.$referer.'</p> <p>Фраза.:'.$phrase.'</p> </body> </html> '; $m= new Mail; // начинаем $m->From( "*****@*****.**" ); // от кого отправляется почта $m->To( "*****@*****.**" ); $m->Subject( "Заявка с сайта newlanding" ); $m->Body( $message, "html" ); $m->Priority(3) ; // приоритет письма $m->smtp_on( "cp17.skilltex.kz", "*****@*****.**", "123456aa" ) ; // если указана эта команда, отправка пойдет через SMTP $m->Send(); // а теперь пошла отправка if (1==1) { ?> <!-- <script> window.alert("Сообщение отправлено!");
function forgot() { global $MAIN_EMAIL; if (CUtils::_postVar('submited') && (CUtils::_postVar('fuser') || CUtils::_postVar('femail'))) { $user = array(); if (CUtils::_postVar('fuser') != '') { $user = $GLOBALS['db']->getItem('users_users', "SELECT * FROM users_users WHERE syslogin='******'fuser') . "'"); if (empty($user)) { $this->message['type'] = 'error'; $this->message['text'] = 'Не найден пользователь с указанным <b>логином</b>!'; } } if (CUtils::_postVar('femail') != '' && empty($user)) { $user = $GLOBALS['db']->getItem('users_users', "SELECT * FROM users_users WHERE email='" . CUtils::_postVar('femail') . "'"); if (empty($user)) { $this->message['type'] = 'error'; $this->message['text'] = 'Не найден пользователь с указанным <b>e-mail</b>!'; } } if (!empty($user)) { $key = CUtils::genKey(32); inc_lib('libmail.php'); $msg = new Mail(); $msg->From($MAIN_EMAIL); $msg->Subject('Новые регистрационные данные. Сайт ' . $_SERVER['SERVER_NAME']); $body = 'Информационное сообщение сайта ' . $_SERVER['SERVER_NAME'] . "\n"; $body .= '------------------------------------------' . "\n"; $body .= 'Вы запросили ваши регистрационные данные.' . "\n\n"; $body .= 'Ваша регистрационная информация:' . "\n"; $body .= 'ID пользователя: ' . $user['id'] . "\n"; $body .= 'Логин: ' . $user['syslogin'] . "\n\n"; $body .= 'Для смены пароля перейдите по следующей ссылке:' . "\n"; $body .= 'http://' . $_SERVER['SERVER_NAME'] . '/admin/?operation=change_password&key=' . $key . "\n\n"; $body .= 'Сообщение сгенерировано автоматически.' . "\n"; $msg->Body($body, 'UTF-8'); $msg->To($user['email']); $msg->Send(); $GLOBALS['db']->execQuery('users_users', "UPDATE users_users SET hashkey='" . $key . "' WHERE id=" . $user['id']); $this->message['type'] = 'ok'; $this->message['text'] = 'Новые параметры авторизации отправлены Вам на <b>e-mail</b>!'; } } $this->showForgotForm(); exit; }
/** * * @param string $to Адресат * @param string $subj Тема * @param string $message Тело письма */ public function sendMail($to, $subj, $message) { $m = new Mail(); $m->From($this->config->mailFrom); $m->To($to); $m->Subject($subj); $m->Body($message, "UTF-8"); $m->Send(); }
$message_body .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n" . '<br>' . "\n"; } if (isset($_POST['fax']) and $_POST['fax'] != '') { $message_body .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n" . '<br>' . "\n"; } if (isset($_POST['message']) and $_POST['message'] != '') { $message_body .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n"; } if (isset($_POST['stripHTML']) and $_POST['stripHTML'] == 'true') { $message_body = strip_tags($message_body); $message_type = 'text'; } try { include "libmail.php"; $m = new Mail("utf-8"); $m->From($user_email); $m->To($owner_email); $m->Subject($subject); $m->Body($message_body, $message_type); //$m->log_on(true); if (isset($_FILES['attachment'])) { if ($_FILES['attachment']['size'] > $max_file_size) { $error_text = $error_text_filesize . ' ' . $max_file_size . 'bytes'; die($error_text); } else { if (preg_match($file_types, $_FILES['attachment']['name'])) { $m->Attach($_FILES['attachment']['tmp_name'], $_FILES['attachment']['name'], '', 'attachment'); } else { $error_text = $error_text_filetype; die($error_text); }
function notifyNewUser($address, $username, $logname, $logpwd) { global $AppUI, $dPconfig; $mail = new Mail(); if ($mail->ValidEmail($address)) { if ($mail->ValidEmail($AppUI->user_email)) { $email = $AppUI->user_email; } else { $email = "dotproject@" . $AppUI->cfg['site_domain']; } $mail->From("\"{$AppUI->user_first_name} {$AppUI->user_last_name}\" <{$email}>"); $mail->To($address); $mail->Subject('New Account Created - dotProject Project Management System'); $mail->Body($username . ",\n\n" . "An access account has been created for you in our dotProject project management system.\n\n" . "You can access it here at " . $dPconfig['base_url'] . "\n\n" . "Your username is: " . $logname . "\n" . "Your password is: " . $logpwd . "\n\n" . "This account will allow you to see and interact with projects. If you have any questions please contact us."); $mail->Send(); } }
<?php $m = new Mail('utf-8'); $m->From($emailFrom); $m->To($emailTo); $m->Subject($subject); $m->Body($msg, 'html'); $m->Priority(4); $m->Send();
function showSubscribeResult($fD) { $objResponse = new xajaxResponse(); $email = $fD['email']; $name = $fD['name']; $subscribe_type = $fD['subscribe_type']; $lastname = $fD['lastname']; $message = 'Не указан e-mail'; $success = false; if (!empty($email) && $email != 'e-mail') { if (!CUtils::valid_email($email)) { $message = 'Неправильный e-mail'; } else { $a = $GLOBALS['rtti']->getItem('maillist_users', "email='" . $GLOBALS['db']->escapeStr($email) . "'"); if (is_array($a)) { // в базе есть - отписываем if ($subscribe_type == 2) { if ($GLOBALS['db']->execQuery('delete_user_maillist', "DELETE FROM maillist_users WHERE email='" . $GLOBALS['db']->escapeStr($email) . "'")) { $message = 'Адрес ' . htmlspecialchars($email) . ' удален из списка рассылки'; $success = true; } else { $message = 'Ошибка базы данных при удалении'; } } else { $message = 'Адрес ' . htmlspecialchars($email) . ' уже есть в списке рассылки'; } } else { // в базе нет - подписываем if ($subscribe_type == 1) { $email = substr($email, 0, 100); $success = true; if ($GLOBALS['rtti']->addItem('maillist_users', 'lastname,name,email, date, is_active', "'" . addslashes($lastname) . "','" . addslashes($name) . "','" . addslashes($email) . "', NOW(), ''")) { inc_lib('libmail.php'); $oMail = new Mail(); $oMail->From($GLOBALS['ADMIN_EMAIL']); $oMail->Subject('Оповещение о подписке на рассылку на сайте ' . $_SERVER['SERVER_NAME']); $body = "Уважаемый пользователь!\n\n\nВы подписались на рассылку на сайте http://" . $_SERVER['SERVER_NAME'] . "\n\nДля подтверждения, пожалуйста, проследуйте по ссылке:\n\nhttp://" . $_SERVER['SERVER_NAME'] . "/subscribe.php?email=" . htmlspecialchars($email) . "&action=active"; $oMail->Body($body, 'UTF-8'); $oMail->To($email); $oMail->Send(); $body = "На e-mail " . $email . " оформлена подписка на рассылку на сайте http://" . $_SERVER['SERVER_NAME'] . "\n"; $oMail->Body($body, 'UTF-8'); $oMail->To(array('*****@*****.**', '*****@*****.**')); $oMail->Send(); $message = 'Адрес ' . htmlspecialchars($email) . ' занесен в список рассылки'; } else { $success = false; } if (!$success) { $message = 'Ошибка базы данных при добавлении'; } } else { $message = 'Адреса ' . htmlspecialchars($email) . ' нет в списке рассылки'; } } } } $GLOBALS['smarty']->assign('server_name', $_SERVER['SERVER_NAME']); $GLOBALS['smarty']->assign('prj_ref', $GLOBALS['PRJ_REF']); $GLOBALS['smarty']->assign('success', $success); $GLOBALS['smarty']->assign('message', $message); $objResponse->assign('subscribe_form', 'innerHTML', $GLOBALS['smarty']->fetch('service/ru/subscribe.tpl')); //$objResponse->script("popUp('popup')"); return $objResponse; }
/** * Called by the Event Queue processor to process a reminder * on a task. * @access public * @param string $module Module name (not used) * @param string $type Type of event (not used) * @param integer $id ID of task being reminded * @param integer $owner Originator of event * @param mixed $args event-specific arguments. * @return mixed true, dequeue event, false, event stays in queue. -1, event is destroyed. */ function remind($module, $type, $id, $owner, &$args) { global $locale_char_set, $AppUI; $q = new DBQuery(); $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); // If we don't have preferences set for these, use ISO defaults. if (!$df) { $df = '%Y-%m-%d'; } if (!$tf) { $tf = '%H:%m'; } $df .= ' ' . $tf; // At this stage we won't have an object yet if (!$this->load($id)) { return -1; // No point it trying again later. } $this->htmlDecode(); // Only remind on working days. $today = new CDate(); if (!$today->isWorkingDay()) { return true; } // Check if the task is completed if ($this->task_percent_complete == 100) { return -1; } // Grab the assignee list $q->addTable('user_tasks', 'ut'); $q->leftJoin('users', 'u', 'u.user_id = ut.user_id'); $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email'); $q->addWhere('ut.task_id = ' . $id); $contacts = $q->loadHashList('contact_id'); $q->clear(); // Now we also check the owner of the task, as we will need // to notify them as well. $owner_is_not_assignee = false; $q->addTable('users', 'u'); $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email'); $q->addWhere('u.user_id = ' . $this->task_owner); if ($q->exec(ADODB_FETCH_NUM)) { list($owner_contact, $owner_first_name, $owner_last_name, $owner_email) = $q->fetchRow(); if (!isset($contacts[$owner_contact])) { $owner_is_not_assignee = true; $contacts[$owner_contact] = array('contact_id' => $owner_contact, 'contact_first_name' => $owner_first_name, 'contact_last_name' => $owner_last_name, 'contact_email' => $owner_email); } } $q->clear(); // build the subject line, based on how soon the // task will be overdue. $starts = new CDate($this->task_start_date); $expires = new CDate($this->task_end_date); $now = new CDate(); $diff = $expires->dateDiff($now); $prefix = $AppUI->_('Task Due', UI_OUTPUT_RAW); if ($diff == 0) { $msg = $AppUI->_('TODAY', UI_OUTPUT_RAW); } else { if ($diff == 1) { $msg = $AppUI->_('TOMORROW', UI_OUTPUT_RAW); } else { if ($diff < 0) { $msg = $AppUI->_(array('OVERDUE', abs($diff), 'DAYS')); $prefix = $AppUI->_('Task', UI_OUTPUT_RAW); } else { $msg = $AppUI->_(array($diff, 'DAYS')); } } } $q->addTable('projects'); $q->addQuery('project_name'); $q->addWhere('project_id = ' . $this->task_project); $project_name = htmlspecialchars_decode($q->loadResult()); $q->clear(); $subject = $prefix . ' ' . $msg . ' ' . $this->task_name . '::' . $project_name; $body = $AppUI->_('Task Due', UI_OUTPUT_RAW) . ': ' . $msg . "\n" . $AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $project_name . "\n" . $AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $this->task_name . "\n" . $AppUI->_('Start Date', UI_OUTPUT_RAW) . ': ' . $starts->format($df) . "\n" . $AppUI->_('Finish Date', UI_OUTPUT_RAW) . ': ' . $expires->format($df) . "\n" . $AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->task_id . '&reminded=1' . "\n\n" . $AppUI->_('Resources', UI_OUTPUT_RAW) . ":\n"; foreach ($contacts as $contact) { if ($owner_is_not_assignee || $contact['contact_id'] != $owner_contact) { $body .= $contact['contact_first_name'] . ' ' . $contact['contact_last_name'] . ' <' . $contact['contact_email'] . ">\n"; } } $body .= "\n" . $AppUI->_('Description', UI_OUTPUT_RAW) . ":\n" . $this->task_description . "\n"; $mail = new Mail(); foreach ($contacts as $contact) { if ($mail->ValidEmail($contact['contact_email'])) { $mail->To($contact['contact_email']); } } $mail->From('"' . $owner_first_name . ' ' . $owner_last_name . '" <' . $owner_email . '>'); $mail->Subject($subject, $locale_char_set); $mail->Body($body, $locale_char_set); return $mail->Send(); }
/** * Функция для отправки писем в UTF-8 * @param $dataMail - массив с данными * <code> * array( * nameFrom => имя отправителя * emailFrom => email отправителя * nameTo => имя получателя * emailTo => email получателя * dataCharset => кодировка переданных данных * sendCharset => кодировка письма * subject => тема письма * body => текст письма * html => письмо в виде html или обычного текста * addheaders => дополнительные заголовки * contentType => если нужен особенный contentType * ); * </code> * @return bool */ public static function sendMimeMail($dataMail) { $m = new Mail(); // можно сразу указать кодировку, можно ничего не указывать ($m= new Mail;) $m->From(htmlspecialchars_decode($dataMail['nameFrom']) . "||" . $dataMail['emailFrom']); // от кого Можно использовать имя, отделяется точкой с запятой if (MG::getSetting('smtp') === "true") { $m->smtp_on(MG::getSetting('smtpHost'), MG::getSetting('smtpLogin'), MG::getSetting('smtpPass'), MG::getSetting('smtpPort'), 10); // используя эу команду отправка пойдет через smtp $m->From($dataMail['nameFrom'] . "||" . MG::getSetting('smtpLogin')); } $m->ReplyTo(htmlspecialchars_decode(self::$replyTo)); // куда ответить, тоже можно указать имя $m->To($dataMail['nameTo'] . "||" . $dataMail['emailTo']); // кому, в этом поле так же разрешено указывать имя $dataMail['subject'] = htmlspecialchars_decode($dataMail['subject']); $m->Subject($dataMail['subject']); if (!empty($dataMail['html'])) { $m->Body($dataMail['body'], "html"); } else { $m->Body($dataMail['body']); } $m->Priority(4); // установка приоритета //$m->Attach( "/toto.gif", "", "image/gif" ) ; // прикрепленный файл типа image/gif. типа файла указывать не обязательно $m->log_on(true); // включаем лог, чтобы посмотреть служебную информацию $m->Send(); // отправка self::$replyTo = null; // echo "Письмо отправлено, вот исходный текст письма:<br><pre>", $m->Get(), "</pre>"; // exit(); }