当前位置: 首页>>代码示例>>PHP>>正文


PHP phpmailer::SetFrom方法代码示例

本文整理汇总了PHP中phpmailer::SetFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP phpmailer::SetFrom方法的具体用法?PHP phpmailer::SetFrom怎么用?PHP phpmailer::SetFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpmailer的用法示例。


在下文中一共展示了phpmailer::SetFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendQRmail

function sendQRmail($from, $to, $subject, $msg, $qrcodeImage, $cid, $name)
{
    include_once 'inc/class.phpmailer.php';
    $mail = new phpmailer();
    $mail->SMTPDebug = 0;
    // debugging: 1 = errors and messages, 2 = messages only, 0 = off
    $mail->IsSMTP();
    // Set mailer to use SMTP
    $mail->Host = 'mailhub.eait.uq.edu.au';
    // Specify server
    $mail->Port = 25;
    // Server port: 465 ssl OR  587 tls
    //$mail->SMTPSecure = 'tls';                       // Enable encryption, 'ssl' also accepted
    $mail->SMTPAuth = false;
    // Enable SMTP authentication
    $mail->Username = 's4329663@student.uq.edu.au';
    // SMTP username
    $mail->Password = 'hongzhe123999';
    // SMTP password
    $mail->SetFrom($from, 'QRappi');
    // Sender
    $mail->AddReplyTo($from, 'Support');
    // Set an alternative reply-to address
    $mail->AddAddress($to, 'User');
    // Set who the message is to be sent to
    $mail->Subject = $subject;
    // Set the subject line
    // Prepares message for html (see doc for details http://phpmailer.worxware.com/?pg=tutorial)
    $mail->MsgHTML($msg);
    // Add the image to the email as an inline element (i.e. not as an attachment)
    $mail->AddStringEmbeddedImage($qrcodeImage, $cid, $name);
    // Send the message, check for errors
    $ok = $mail->Send();
    return $ok;
}
开发者ID:Hongzhe,项目名称:DECO3801-PeerTech,代码行数:35,代码来源:mail.php

示例2: Init

 /**
  * Инициализация модуля
  *
  */
 public function Init()
 {
     // * Настройки SMTP сервера для отправки писем
     $this->sHost = Config::Get('sys.mail.smtp.host');
     $this->iPort = Config::Get('sys.mail.smtp.port');
     $this->sUsername = Config::Get('sys.mail.smtp.user');
     $this->sPassword = Config::Get('sys.mail.smtp.password');
     $this->bSmtpAuth = Config::Get('sys.mail.smtp.auth');
     $this->sSmtpSecure = Config::Get('sys.mail.smtp.secure');
     // * Метод отправки почты
     $this->sMailerType = Config::Get('sys.mail.type');
     // * Кодировка писем
     $this->sCharSet = Config::Get('sys.mail.charset');
     // * Кодирование писем
     $this->sEncoding = Config::Get('sys.mail.encoding');
     // * Мыло от кого отправляется вся почта
     $this->sFrom = Config::Get('sys.mail.from_email');
     // * Имя от кого отправляется вся почта
     $this->sFromName = Config::Get('sys.mail.from_name');
     // * Создаём объект phpMailer и устанвливаем ему необходимые настройки
     $this->oMailer = new PHPMailer();
     // Вывод ошибок через ob_get_clean() возможен только с включением этой опции.
     // Иначе все ошибки будут с содержанием: «Cannot send email».
     // Однако, в случае ошибки отправки, в лог будет записан текст запросов к smtp-серверу, включая логин и пароль.
     $this->oMailer->SMTPDebug = defined('DEBUG') && DEBUG;
     $this->oMailer->Host = $this->sHost;
     $this->oMailer->Port = $this->iPort;
     $this->oMailer->Username = $this->sUsername;
     $this->oMailer->Password = $this->sPassword;
     $this->oMailer->SMTPAuth = $this->bSmtpAuth;
     $this->oMailer->SMTPSecure = $this->sSmtpSecure;
     $this->oMailer->Mailer = $this->sMailerType;
     $this->oMailer->WordWrap = $this->iWordWrap;
     $this->oMailer->CharSet = $this->sCharSet;
     $this->oMailer->Encoding = $this->sEncoding;
     // see https://github.com/altocms/altocms/issues/259
     //$this->oMailer->From = $this->sFrom;
     //$this->oMailer->FromName = $this->sFromName;
     $this->oMailer->SetFrom($this->sFrom, $this->sFromName);
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:44,代码来源:Mail.class.php

示例3: Init

 /**
  * Инициализация модуля
  *
  */
 public function Init()
 {
     // * Настройки SMTP сервера для отправки писем
     $this->sHost = Config::Get('sys.mail.smtp.host');
     $this->iPort = Config::Get('sys.mail.smtp.port');
     $this->sUsername = Config::Get('sys.mail.smtp.user');
     $this->sPassword = Config::Get('sys.mail.smtp.password');
     $this->bSmtpAuth = Config::Get('sys.mail.smtp.auth');
     $this->sSmtpSecure = Config::Get('sys.mail.smtp.secure');
     // * Метод отправки почты
     $this->sMailerType = Config::Get('sys.mail.type');
     // * Кодировка писем
     $this->sCharSet = Config::Get('sys.mail.charset');
     // * Кодирование писем
     $this->sEncoding = Config::Get('sys.mail.encoding');
     // * Мыло от кого отправляется вся почта
     $this->sFrom = Config::Get('sys.mail.from_email');
     // * Имя от кого отправляется вся почта
     $this->sFromName = Config::Get('sys.mail.from_name');
     // * Создаём объект phpMailer и устанвливаем ему необходимые настройки
     $this->oMailer = new PHPMailer();
     $this->oMailer->Host = $this->sHost;
     $this->oMailer->Port = $this->iPort;
     $this->oMailer->Username = $this->sUsername;
     $this->oMailer->Password = $this->sPassword;
     $this->oMailer->SMTPAuth = $this->bSmtpAuth;
     $this->oMailer->SMTPSecure = $this->sSmtpSecure;
     $this->oMailer->Mailer = $this->sMailerType;
     $this->oMailer->WordWrap = $this->iWordWrap;
     $this->oMailer->CharSet = $this->sCharSet;
     $this->oMailer->Encoding = $this->sEncoding;
     // see https://github.com/altocms/altocms/issues/259
     //$this->oMailer->From = $this->sFrom;
     //$this->oMailer->FromName = $this->sFromName;
     $this->oMailer->SetFrom($this->sFrom, $this->sFromName);
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:40,代码来源:Mail.class.php

示例4: send

 function send()
 {
     global $objDatabase, $_ARRAYLANG, $_CONFIG;
     $this->_objTpl->setTemplate($this->pageContent);
     // Initialize variables
     $code = substr(md5(rand()), 1, 10);
     $url = \Cx\Core\Routing\Url::fromModuleAndCmd('Ecard', 'show', '', array('code' => $code))->toString();
     // Initialize POST variables
     $id = intval($_POST['selectedEcard']);
     $message = contrexx_addslashes($_POST['ecardMessage']);
     $recipientSalutation = contrexx_stripslashes($_POST['ecardRecipientSalutation']);
     $senderName = contrexx_stripslashes($_POST['ecardSenderName']);
     $senderEmail = \FWValidator::isEmail($_POST['ecardSenderEmail']) ? $_POST['ecardSenderEmail'] : '';
     $recipientName = contrexx_stripslashes($_POST['ecardRecipientName']);
     $recipientEmail = \FWValidator::isEmail($_POST['ecardRecipientEmail']) ? $_POST['ecardRecipientEmail'] : '';
     if (empty($senderEmail) || empty($recipientEmail)) {
         $this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
         return false;
     }
     $query = "\n            SELECT `setting_name`, `setting_value`\n              FROM " . DBPREFIX . "module_ecard_settings";
     $objResult = $objDatabase->Execute($query);
     while (!$objResult->EOF) {
         switch ($objResult->fields['setting_name']) {
             case 'validdays':
                 $validdays = $objResult->fields['setting_value'];
                 break;
                 // Never used
                 //                case 'greetings':
                 //                    $greetings = $objResult->fields['setting_value'];
                 //                    break;
             // Never used
             //                case 'greetings':
             //                    $greetings = $objResult->fields['setting_value'];
             //                    break;
             case 'subject':
                 $subject = $objResult->fields['setting_value'];
                 break;
             case 'emailText':
                 $emailText = strip_tags($objResult->fields['setting_value']);
                 break;
         }
         $objResult->MoveNext();
     }
     $timeToLife = $validdays * 86400;
     // Replace placeholders with used in notification mail with user data
     $emailText = str_replace('[[ECARD_RECIPIENT_SALUTATION]]', $recipientSalutation, $emailText);
     $emailText = str_replace('[[ECARD_RECIPIENT_NAME]]', $recipientName, $emailText);
     $emailText = str_replace('[[ECARD_RECIPIENT_EMAIL]]', $recipientEmail, $emailText);
     $emailText = str_replace('[[ECARD_SENDER_NAME]]', $senderName, $emailText);
     $emailText = str_replace('[[ECARD_SENDER_EMAIL]]', $senderEmail, $emailText);
     $emailText = str_replace('[[ECARD_VALID_DAYS]]', $validdays, $emailText);
     $emailText = str_replace('[[ECARD_URL]]', $url, $emailText);
     $body = $emailText;
     // Insert ecard to DB
     $query = "\n            INSERT INTO `" . DBPREFIX . "module_ecard_ecards` (\n                code, date, TTL, salutation,\n                senderName, senderEmail,\n                recipientName, recipientEmail,\n                message\n            ) VALUES (\n                '" . $code . "',\n                '" . time() . "',\n                '" . $timeToLife . "',\n                '" . addslashes($recipientSalutation) . "',\n                '" . addslashes($senderName) . "',\n                '" . $senderEmail . "',\n                '" . addslashes($recipientName) . "',\n                '" . $recipientEmail . "',\n                '" . $message . "');";
     if ($objDatabase->Execute($query)) {
         $query = "\n                SELECT setting_value\n                  FROM " . DBPREFIX . "module_ecard_settings\n                 WHERE setting_name='motive_{$id}'";
         $objResult = $objDatabase->SelectLimit($query, 1);
         // Copy motive to new file with $code as filename
         $fileExtension = preg_replace('/^.+(\\.[^\\.]+)$/', '$1', $objResult->fields['setting_value']);
         $fileName = $objResult->fields['setting_value'];
         $objFile = new \File();
         if ($objFile->copyFile(ASCMS_ECARD_OPTIMIZED_PATH . '/', $fileName, ASCMS_ECARD_SEND_ECARDS_PATH . '/', $code . $fileExtension)) {
             $objMail = new \phpmailer();
             // Check e-mail settings
             if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
                 $objSmtpSettings = new \SmtpSettings();
                 if (($arrSmtp = $objSmtpSettings->getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                     $objMail->IsSMTP();
                     $objMail->Host = $arrSmtp['hostname'];
                     $objMail->Port = $arrSmtp['port'];
                     $objMail->SMTPAuth = true;
                     $objMail->Username = $arrSmtp['username'];
                     $objMail->Password = $arrSmtp['password'];
                 }
             }
             // Send notification mail to ecard-recipient
             $objMail->CharSet = CONTREXX_CHARSET;
             $objMail->SetFrom($senderEmail, $senderName);
             $objMail->Subject = $subject;
             $objMail->IsHTML(false);
             $objMail->Body = $body;
             $objMail->AddAddress($recipientEmail);
             if ($objMail->Send()) {
                 $this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_HAS_BEEN_SENT']));
             } else {
                 $this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_MAIL_SENDING_ERROR']));
             }
         }
     } else {
         $this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:93,代码来源:Ecard.class.php

示例5: sendMail


//.........这里部分代码省略.........
                     $objTemplate->parse('field_' . $fieldId);
                 } elseif ($objTemplate->blockExists('form_field')) {
                     // parse regular field template block
                     $objTemplate->setVariable(array('FIELD_LABEL' => contrexx_raw2xhtml($fieldLabel), 'FIELD_VALUE' => $htmlValue));
                     $objTemplate->parse('form_field');
                 }
             } elseif ($objTemplate->blockExists('field_' . $fieldId)) {
                 // hide field specific template block, if present
                 $objTemplate->hideBlock('field_' . $fieldId);
             }
         }
         // parse plaintext body
         $tabCount = $maxlength - strlen($fieldLabel);
         $tabs = $tabCount == 0 ? 1 : $tabCount + 1;
         // TODO: what is this all about? - $value is undefined
         if ($arrFormData['fields'][$fieldId]['type'] == 'recipient') {
             $value = $arrRecipients[$value]['lang'][FRONTEND_LANG_ID];
         }
         if (in_array($fieldId, $textAreaKeys)) {
             // we're dealing with a textarea, don't indent value
             $plaintextBody .= $fieldLabel . ":\n" . $plaintextValue . "\n";
         } else {
             $plaintextBody .= $fieldLabel . str_repeat(" ", $tabs) . ": " . $plaintextValue . "\n";
         }
     }
     $arrSettings = $this->getSettings();
     // TODO: this is some fixed plaintext message data -> must be ported to html body
     $message = $_ARRAYLANG['TXT_CONTACT_TRANSFERED_DATA_FROM'] . " " . $_CONFIG['domainUrl'] . "\n\n";
     if ($arrSettings['fieldMetaDate']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_DATE'] . " " . date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']) . "\n\n";
     }
     $message .= $plaintextBody . "\n\n";
     if ($arrSettings['fieldMetaHost']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_HOSTNAME'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['host']) . "\n";
     }
     if ($arrSettings['fieldMetaIP']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_IP_ADDRESS'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['ipaddress']) . "\n";
     }
     if ($arrSettings['fieldMetaLang']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_LANGUAGE'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['lang']) . "\n";
     }
     $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_VERSION'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['browser']) . "\n";
     if (@(include_once \Env::get('cx')->getCodeBaseLibraryPath() . '/phpmailer/class.phpmailer.php')) {
         $objMail = new \phpmailer();
         if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once \Env::get('cx')->getCodeBaseCorePath() . '/SmtpSettings.class.php')) {
             if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                 $objMail->IsSMTP();
                 $objMail->Host = $arrSmtp['hostname'];
                 $objMail->Port = $arrSmtp['port'];
                 $objMail->SMTPAuth = true;
                 $objMail->Username = $arrSmtp['username'];
                 $objMail->Password = $arrSmtp['password'];
             }
         }
         $objMail->CharSet = CONTREXX_CHARSET;
         if (!empty($replyAddress)) {
             $objMail->AddReplyTo($replyAddress);
             if ($arrFormData['sendCopy'] == 1) {
                 $objMail->AddAddress($replyAddress);
             }
         }
         if (!empty($replyAddress) && $arrFormData['useEmailOfSender'] == 1) {
             $objMail->SetFrom($replyAddress, $senderName !== $_CONFIG['coreGlobalPageTitle'] ? $senderName : '');
         } else {
             $objMail->SetFrom($_CONFIG['coreAdminEmail'], $senderName);
         }
         $objMail->Subject = $arrFormData['subject'];
         if ($isHtml) {
             $objMail->Body = $objTemplate->get();
             $objMail->AltBody = $message;
         } else {
             $objMail->IsHTML(false);
             $objMail->Body = $message;
         }
         // attach submitted files to email
         if (count($arrFormData['uploadedFiles']) > 0 && $arrFormData['sendAttachment'] == 1) {
             foreach ($arrFormData['uploadedFiles'] as $arrFilesOfField) {
                 foreach ($arrFilesOfField as $file) {
                     $objMail->AddAttachment(\Env::get('cx')->getWebsiteDocumentRootPath() . $file['path'], $file['name']);
                 }
             }
         }
         if ($chosenMailRecipient !== null) {
             if (!empty($chosenMailRecipient)) {
                 $objMail->AddAddress($chosenMailRecipient);
                 $objMail->Send();
                 $objMail->ClearAddresses();
             }
         } else {
             foreach ($arrFormData['emails'] as $sendTo) {
                 if (!empty($sendTo)) {
                     $objMail->AddAddress($sendTo);
                     $objMail->Send();
                     $objMail->ClearAddresses();
                 }
             }
         }
     }
     return true;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:Contact.class.php

示例6: Send


//.........这里部分代码省略.........
     } else {
         $y = 1;
     }
     // si se deseára configurar los parametros de el dominio
     // y cuenta de correo default, aquí se recibirian los parámetros.
     $port = $this->port;
     $smtp_secure = $this->smtp_secure;
     $auth = $this->auth;
     $host = $this->host;
     $username = $this->username;
     $password = $this->password;
     $mail = new phpmailer();
     $mail->CharSet = 'UTF-8';
     $mail->Mailer = "smtp";
     $mail->IsSMTP();
     ini_set('max_execution_time', 600);
     $mail->SMTPAuth = true;
     // si se indica un puerto este se utilizara,
     // de lo contrario su usará el default.
     if (empty($port)) {
         $mail->Port = 465;
     } else {
         $mail->Port = $port;
     }
     // si se indica un tipo de seguridad este se utilizara,
     // de lo contrario su usará el default.
     if (empty($smtp_secure)) {
         $mail->SMTPSecure = 'ssl';
     } else {
         $mail->SMTPSecure = $smtp_secure;
     }
     // si se indica un cambio en la autenticación este se utilizara,
     // de lo contrario su usará el default.
     if (empty($auth)) {
         $mail->SMTPAuth = true;
     } else {
         $mail->SMTPAuth = $auth;
     }
     // si se indica un host este se utilizara,
     // de lo contrario su usará el default.
     if (empty($host)) {
         $mail->Host = "securemail.aplus.net";
     } else {
         $mail->Host = $host;
     }
     // si se indica un usuario este se utilizara,
     // de lo contrario su usará el default.
     if (empty($username)) {
         $mail->Username = "basededatos@globalcorporation.cc";
     } else {
         $mail->Username = $username;
     }
     // si se indica un password este se utilizara,
     // de lo contrario su usará el default.
     if (empty($password)) {
         $mail->Password = "kIU8a#4i";
     } else {
         $mail->Password = $password;
     }
     $mail->Subject = $subject;
     if ($def_from == 1) {
         $mail->SetFrom($from[1], $from[0]);
     } else {
         $mail->SetFrom('basededatos@globalcorporation.cc', 'Global Corporation');
     }
     if ($rp == 1) {
         $mail->AddReplyTo($replyto[1], $replyto[0]);
     }
     $mail->Body = " ";
     $mail->MsgHTML($body);
     if ($z == 2) {
         for ($a = 0; $a < count($attachment_r); $a++) {
             $mail->AddAttachment($attachment_r[$a], $attachment_t[$a]);
         }
     }
     if ($y == 2) {
         for ($a = 0; $a < count($embeddedimg_r); $a++) {
             $mail->AddEmbeddedImage($embeddedimg_r[$a], $embeddedimg_t[$a]);
         }
     }
     for ($i = 0; $i < count($to); $i++) {
         $a = $to[$i];
         $mail->AddAddress($a['direccion'], $a['nombre']);
     }
     for ($j = 0; $j < count($cc); $j++) {
         $a = $cc[$j];
         $mail->AddCC($a['direccion'], $a['nombre']);
     }
     for ($k = 0; $k < count($cco); $k++) {
         $a = $cco[$k];
         $mail->AddBCC($a['direccion'], $a['nombre']);
     }
     $mail->IsHTML(true);
     if ($mail->Send()) {
         return true;
     } else {
         $this->errors = "SEND_MAIL_ERROR " . $mail->ErrorInfo;
         return 0;
     }
 }
开发者ID:JesusHV,项目名称:restaurantes,代码行数:101,代码来源:Mailerclass.php

示例7: updateOrder

 /**
  * Update the order status and send the confirmation mail
  * according to the settings
  *
  * The resulting javascript code displays a message box or
  * does some page redirect.
  * @param   integer   $order_id       The order ID
  * @return  string                    Javascript code
  * @static
  */
 static function updateOrder($order_id, $newStatus = 1)
 {
     global $_ARRAYLANG, $_CONFIG;
     $product_id = self::getOrderValue('order_product', $order_id);
     if (empty($product_id)) {
         return 'alert("' . $_ARRAYLANG['TXT_EGOV_ERROR_UPDATING_ORDER'] . '");' . "\n";
     }
     // Has this order been updated already?
     $orderStatus = self::GetOrderValue('order_state', $order_id);
     if ($orderStatus != 0) {
         // Do not resend mails!
         return '';
     }
     $arrFields = self::getOrderValues($order_id);
     $FormValue4Mail = '';
     $arrMatch = array();
     foreach ($arrFields as $name => $value) {
         // If the value matches a calendar date, prefix the string with
         // the day of the week
         if (preg_match('/^(\\d\\d?)\\.(\\d\\d?)\\.(\\d\\d\\d\\d)$/', $value, $arrMatch)) {
             // ISO-8601 numeric representation of the day of the week
             // 1 (for Monday) through 7 (for Sunday)
             $dotwNumber = date('N', mktime(1, 1, 1, $arrMatch[2], $arrMatch[1], $arrMatch[3]));
             $dotwName = $_ARRAYLANG['TXT_EGOV_DAYNAME_' . $dotwNumber];
             $value = "{$dotwName}, {$value}";
         }
         $FormValue4Mail .= html_entity_decode($name) . ': ' . html_entity_decode($value) . "\n";
     }
     // Bestelleingang-Benachrichtigung || Mail f�r den Administrator
     $recipient = self::GetProduktValue('product_target_email', $product_id);
     if (empty($recipient)) {
         $recipient = self::GetSettings('set_orderentry_recipient');
     }
     if (!empty($recipient)) {
         $SubjectText = str_replace('[[PRODUCT_NAME]]', html_entity_decode(self::GetProduktValue('product_name', $product_id)), self::GetSettings('set_orderentry_subject'));
         $SubjectText = html_entity_decode($SubjectText);
         $BodyText = str_replace('[[ORDER_VALUE]]', $FormValue4Mail, self::GetSettings('set_orderentry_email'));
         $BodyText = html_entity_decode($BodyText);
         $replyAddress = self::GetEmailAdress($order_id);
         if (empty($replyAddress)) {
             $replyAddress = self::GetSettings('set_orderentry_sender');
         }
         if (@(include_once ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
             $objMail = new \phpmailer();
             if (!empty($_CONFIG['coreSmtpServer'])) {
                 if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                     $objMail->IsSMTP();
                     $objMail->Host = $arrSmtp['hostname'];
                     $objMail->Port = $arrSmtp['port'];
                     $objMail->SMTPAuth = true;
                     $objMail->Username = $arrSmtp['username'];
                     $objMail->Password = $arrSmtp['password'];
                 }
             }
             $objMail->CharSet = CONTREXX_CHARSET;
             $from = self::GetSettings('set_orderentry_sender');
             $fromName = self::GetSettings('set_orderentry_name');
             $objMail->AddReplyTo($replyAddress);
             $objMail->SetFrom($from, $fromName);
             $objMail->Subject = $SubjectText;
             $objMail->Priority = 3;
             $objMail->IsHTML(false);
             $objMail->Body = $BodyText;
             $objMail->AddAddress($recipient);
             $objMail->Send();
         }
     }
     // Update 29.10.2006 Statusmail automatisch abschicken || Produktdatei
     if (self::GetProduktValue('product_electro', $product_id) == 1 || self::GetProduktValue('product_autostatus', $product_id) == 1) {
         self::updateOrderStatus($order_id, $newStatus);
         $TargetMail = self::GetEmailAdress($order_id);
         if ($TargetMail != '') {
             $FromEmail = self::GetProduktValue('product_sender_email', $product_id);
             if ($FromEmail == '') {
                 $FromEmail = self::GetSettings('set_sender_email');
             }
             $FromName = self::GetProduktValue('product_sender_name', $product_id);
             if ($FromName == '') {
                 $FromName = self::GetSettings('set_sender_name');
             }
             $SubjectDB = self::GetProduktValue('product_target_subject', $product_id);
             if ($SubjectDB == '') {
                 $SubjectDB = self::GetSettings('set_state_subject');
             }
             $SubjectText = str_replace('[[PRODUCT_NAME]]', html_entity_decode(self::GetProduktValue('product_name', $product_id)), $SubjectDB);
             $SubjectText = html_entity_decode($SubjectText);
             $BodyDB = self::GetProduktValue('product_target_body', $product_id);
             if ($BodyDB == '') {
                 $BodyDB = self::GetSettings('set_state_email');
             }
//.........这里部分代码省略.........
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:Egov.class.php

示例8: send

 /**
  * Set up and send an email from the shop.
  * @static
  * @param   string    $mailTo           Recipient mail address
  * @param   string    $mailFrom         Sender mail address
  * @param   string    $mailSender       Sender name
  * @param   string    $mailSubject      Message subject
  * @param   string    $mailBody         Message body
  * @return  boolean                     True if the mail could be sent,
  *                                      false otherwise
  * @author  Reto Kohli <reto.kohli@comvation.com>
  */
 static function send($mailTo, $mailFrom, $mailSender, $mailSubject, $mailBody)
 {
     global $_CONFIG;
     if (@(include_once ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
         $objMail = new phpmailer();
         if (isset($_CONFIG['coreSmtpServer']) && $_CONFIG['coreSmtpServer'] > 0 && @(include_once ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
             if (($arrSmtp = SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                 $objMail->IsSMTP();
                 $objMail->Host = $arrSmtp['hostname'];
                 $objMail->Port = $arrSmtp['port'];
                 $objMail->SMTPAuth = true;
                 $objMail->Username = $arrSmtp['username'];
                 $objMail->Password = $arrSmtp['password'];
             }
         }
         $objMail->CharSet = CONTREXX_CHARSET;
         $from = preg_replace('/\\015\\012/', '', $mailFrom);
         $fromName = preg_replace('/\\015\\012/', '', $mailSender);
         $objMail->SetFrom($from, $fromName);
         $objMail->Subject = $mailSubject;
         $objMail->IsHTML(false);
         $objMail->Body = preg_replace('/\\015\\012/', "\n", $mailBody);
         $objMail->AddAddress($mailTo);
         if ($objMail->Send()) {
             return true;
         }
     }
     return false;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:41,代码来源:Mail.class.php

示例9: elseif

 /**
  * Send Recommendation
  *
  * Send an email if the input is valid. Otherwise
  * Show some error messages and the form again
  */
 function _sendRecomm()
 {
     global $_ARRAYLANG, $_CONFIG, $_LANGID, $_CORELANG;
     if (empty($_POST['receivername'])) {
         $this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_RECEIVER_NAME'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
     }
     if (empty($_POST['receivermail'])) {
         $this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_RECEIVER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
     } elseif (!$this->isEmail($_POST['receivermail'])) {
         $this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_RECEIVER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_INVALID'] . '<br />';
     }
     if (empty($_POST['sendername'])) {
         $this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_SENDER_NAME'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
     }
     if (empty($_POST['sendermail'])) {
         $this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_SENDER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
     } elseif (!$this->isEmail($_POST['sendermail'])) {
         $this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_SENDER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_INVALID'] . '<br />';
     }
     if (empty($_POST['comment'])) {
         $this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_COMMENT'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
     }
     $receivername = $_POST['receivername'];
     $receivermail = $_POST['receivermail'];
     $sendername = $_POST['sendername'];
     $sendermail = $_POST['sendermail'];
     $comment = $_POST['comment'];
     if (!empty($this->_pageMessage) || !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
         //something's missing or wrong
         $this->_objTpl->setVariable('RECOM_STATUS', '<div class="text-danger">' . $this->_pageMessage . '</div>');
         $this->_objTpl->setCurrentBlock('recommend_form');
         $this->_objTpl->setVariable(array('RECOM_SCRIPT' => $this->getJs(), 'RECOM_RECEIVER_NAME' => stripslashes($receivername), 'RECOM_RECEIVER_MAIL' => stripslashes($receivermail), 'RECOM_SENDER_NAME' => stripslashes($sendername), 'RECOM_SENDER_MAIL' => stripslashes($sendermail), 'RECOM_COMMENT' => stripslashes($comment), 'RECOM_PREVIEW' => $this->getMessageBody($_LANGID), 'RECOM_FEMALE_SALUTATION_TEXT' => $this->getFemaleSalutation($_LANGID), 'RECOM_MALE_SALUTATION_TEXT' => $this->getMaleSalutation($_LANGID)));
         $this->_objTpl->setVariable(array('RECOM_TXT_RECEIVER_NAME' => $_ARRAYLANG['TXT_RECEIVERNAME_FRONTEND'], 'RECOM_TXT_RECEIVER_MAIL' => $_ARRAYLANG['TXT_RECEIVERMAIL_FRONTEND'], 'RECOM_TXT_GENDER' => $_ARRAYLANG['TXT_GENDER_FRONTEND'], 'RECOM_TXT_SENDER_NAME' => $_ARRAYLANG['TXT_SENDERNAME_FRONTEND'], 'RECOM_TXT_SENDER_MAIL' => $_ARRAYLANG['TXT_SENDERMAIL_FRONTEND'], 'RECOM_TXT_COMMENT' => $_ARRAYLANG['TXT_COMMENT_FRONTEND'], 'RECOM_TXT_PREVIEW' => $_ARRAYLANG['TXT_PREVIEW_FRONTEND'], 'RECOM_TXT_FEMALE' => $_ARRAYLANG['TXT_FEMALE_FRONTEND'], 'RECOM_TXT_MALE' => $_ARRAYLANG['TXT_MALE_FRONTEND'], 'RECOM_TEXT' => $_ARRAYLANG['TXT_INTRODUCTION'], 'TXT_RECOMMEND_SEND' => $_ARRAYLANG['TXT_RECOMMEND_SEND'], 'TXT_RECOMMEND_DELETE' => $_ARRAYLANG['TXT_RECOMMEND_DELETE']));
         $this->_objTpl->setVariable(array('RECOM_TXT_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'RECOM_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
         if ($this->_objTpl->blockExists('recommend_captcha')) {
             $this->_objTpl->parse('recommend_captcha');
         } else {
             $this->_objTpl->hideBlock('recommend_captcha');
         }
         $this->_objTpl->parseCurrentBlock('recommend_form');
         $this->_objTpl->parse();
     } else {
         //data is valid
         if (empty($_POST['uri'])) {
             $url = ASCMS_PROTOCOL . '://' . $_SERVER['HTTP_HOST'] . ASCMS_PATH_OFFSET;
         } else {
             $url = $_POST['uri'];
         }
         if ($_POST['gender'] == 'male') {
             $salutation = $this->getMaleSalutation($_LANGID);
         } else {
             $salutation = $this->getFemaleSalutation($_LANGID);
         }
         $body = $this->getMessageBody($_LANGID);
         $body = preg_replace('/<SENDER_NAME>/', $sendername, $body);
         $body = preg_replace('/<SENDER_MAIL>/', $sendermail, $body);
         $body = preg_replace('/<RECEIVER_NAME>/', $receivername, $body);
         $body = preg_replace('/<RECEIVER_MAIL>/', $receivermail, $body);
         $body = preg_replace('/<URL>/', $url, $body);
         $body = preg_replace('/<COMMENT>/', $comment, $body);
         $body = preg_replace('/<SALUTATION>/', $salutation, $body);
         $subject = $this->getMessageSubject($_LANGID);
         $subject = preg_replace('/<SENDER_NAME>/', $sendername, $subject);
         $subject = preg_replace('/<SENDER_MAIL>/', $sendermail, $subject);
         $subject = preg_replace('/<RECEIVER_NAME>/', $receivername, $subject);
         $subject = preg_replace('/<RECEIVER_MAIL>/', $receivermail, $subject);
         $subject = preg_replace('/<URL>/', $url, $subject);
         $subject = preg_replace('/<COMMENT>/', $comment, $subject);
         $subject = preg_replace('/<SALUTATION>/', $salutation, $subject);
         if (@(include_once ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
             $objMail = new \phpmailer();
             if ($_CONFIG['coreSmtpServer'] > 0) {
                 if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                     $objMail->IsSMTP();
                     $objMail->Host = $arrSmtp['hostname'];
                     $objMail->Port = $arrSmtp['port'];
                     $objMail->SMTPAuth = true;
                     $objMail->Username = $arrSmtp['username'];
                     $objMail->Password = $arrSmtp['password'];
                 }
             }
             $objMail->CharSet = CONTREXX_CHARSET;
             $objMail->SetFrom($sendermail, $sendername);
             $objMail->Subject = $subject;
             $objMail->IsHTML(false);
             $objMail->Body = $body;
             $objMail->AddAddress($receivermail);
             $objMail->Send();
             $objMail->ClearAddresses();
             $objMail->AddAddress($_CONFIG['contactFormEmail']);
             $objMail->Send();
         }
         $this->_objTpl->setVariable('RECOM_STATUS', $_ARRAYLANG['TXT_SENT_OK']);
         $this->_objTpl->parse();
//.........这里部分代码省略.........
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:Recommend.class.php

示例10: mailrestaurar

function mailrestaurar($email, $passnew)
{
    require_once '../mail/class.phpmailer.php';
    require "../mail/class.smtp.php";
    $mail = new phpmailer();
    $mail->PluginDir = '../mail/';
    $mail->SMTPSecure = "tls";
    $mail->Host = "smtp.gmail.com";
    $mail->SMTPAuth = true;
    $mail->Username = "virysanm@gmail.com";
    $mail->Password = "viry0704";
    $mail->Port = 587;
    //puerto de autenticacion que usa gmail
    $mail->AddAddress($email);
    $mail->IsHTML = true;
    $mail->MsgHTML('Recuperacion de Password <br><br> Punto de Encuentro te envia el siguiente Password, para que puedas entrar a tu usuario<br><br>Password: ' . $passnew . '<br><br> Ingresa a este Link: http://proyectospi.com/PuntodeEncuentroP/html/pages/changepassword.php <br><br>para Ingresar a tu sesion con la Password que te enviamos en este correo.');
    $mail->SetFrom("virysanm@gmail.com", "Punto de Encuentro");
    $mail­ > Subject == "Recuperacion de Password";
    //indico destinatario
    $exito = $mail->Send();
    if (!$exito) {
        echo "Error al enviar: " . $mail­ > ErrorInfo;
    } else {
        echo "Ok";
    }
}
开发者ID:VirySanm,项目名称:PuntodeEncuentro,代码行数:26,代码来源:utilities.php

示例11: sendMail

 /**
  * Initialize the mail functionality to the recipient
  *
  * @param \Cx\Modules\Calendar\Controller\CalendarEvent $event          Event instance
  * @param integer                                       $actionId       Mail action id
  * @param integer                                       $regId          Registration id
  * @param string                                        $mailTemplate   Mail template id
  */
 function sendMail(CalendarEvent $event, $actionId, $regId = null, $mailTemplate = null)
 {
     global $objDatabase, $_ARRAYLANG, $_CONFIG;
     $this->mailList = array();
     // Loads the mail template which needs for this action
     $this->loadMailList($actionId, $mailTemplate);
     if (!empty($this->mailList)) {
         $objRegistration = null;
         if (!empty($regId)) {
             $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration($event->registrationForm, $regId);
             list($registrationDataText, $registrationDataHtml) = $this->getRegistrationData($objRegistration);
             $query = 'SELECT `v`.`value`, `n`.`default`, `f`.`type`
                       FROM ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_value AS `v`
                       INNER JOIN ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_name AS `n`
                       ON `v`.`field_id` = `n`.`field_id`
                       INNER JOIN ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field AS `f`
                       ON `v`.`field_id` = `f`.`id`
                       WHERE `v`.`reg_id` = ' . $regId . '
                       AND (
                              `f`.`type` = "salutation"
                           OR `f`.`type` = "firstname"
                           OR `f`.`type` = "lastname"
                           OR `f`.`type` = "mail"
                       )';
             $objResult = $objDatabase->Execute($query);
             $arrDefaults = array();
             $arrValues = array();
             if ($objResult !== false) {
                 while (!$objResult->EOF) {
                     if (!empty($objResult->fields['default'])) {
                         $arrDefaults[$objResult->fields['type']] = explode(',', $objResult->fields['default']);
                     }
                     $arrValues[$objResult->fields['type']] = $objResult->fields['value'];
                     $objResult->MoveNext();
                 }
             }
             $regSalutation = !empty($arrValues['salutation']) ? $arrDefaults['salutation'][$arrValues['salutation'] - 1] : '';
             $regFirstname = !empty($arrValues['firstname']) ? $arrValues['firstname'] : '';
             $regLastname = !empty($arrValues['lastname']) ? $arrValues['lastname'] : '';
             $regMail = !empty($arrValues['mail']) ? $arrValues['mail'] : '';
             $regType = $objRegistration->type == 1 ? $_ARRAYLANG['TXT_CALENDAR_REG_REGISTRATION'] : $_ARRAYLANG['TXT_CALENDAR_REG_SIGNOFF'];
             $regSearch = array('[[REGISTRATION_TYPE]]', '[[REGISTRATION_SALUTATION]]', '[[REGISTRATION_FIRSTNAME]]', '[[REGISTRATION_LASTNAME]]', '[[REGISTRATION_EMAIL]]');
             $regReplace = array($regType, $regSalutation, $regFirstname, $regLastname, $regMail);
         }
         $domain = ASCMS_PROTOCOL . "://" . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . "/";
         $date = $this->format2userDateTime(new \DateTime());
         $startDate = $event->startDate;
         $endDate = $event->endDate;
         $eventTitle = $event->title;
         $eventStart = $event->all_day ? $this->format2userDate($startDate) : $this->formatDateTime2user($startDate, $this->getDateFormat() . ' (H:i:s)');
         $eventEnd = $event->all_day ? $this->format2userDate($endDate) : $this->formatDateTime2user($endDate, $this->getDateFormat() . ' (H:i:s)');
         $placeholder = array('[[TITLE]]', '[[START_DATE]]', '[[END_DATE]]', '[[LINK_EVENT]]', '[[LINK_REGISTRATION]]', '[[USERNAME]]', '[[FIRSTNAME]]', '[[LASTNAME]]', '[[URL]]', '[[DATE]]');
         $recipients = $this->getSendMailRecipients($actionId, $event, $regId, $objRegistration);
         $objMail = new \phpmailer();
         if ($_CONFIG['coreSmtpServer'] > 0) {
             $arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer']);
             if ($arrSmtp !== false) {
                 $objMail->IsSMTP();
                 $objMail->Host = $arrSmtp['hostname'];
                 $objMail->Port = $arrSmtp['port'];
                 $objMail->SMTPAuth = true;
                 $objMail->Username = $arrSmtp['username'];
                 $objMail->Password = $arrSmtp['password'];
             }
         }
         $objMail->CharSet = CONTREXX_CHARSET;
         $objMail->SetFrom($_CONFIG['coreAdminEmail'], $_CONFIG['coreGlobalPageTitle']);
         foreach ($recipients as $mailAdress => $langId) {
             if (!empty($mailAdress)) {
                 $langId = $this->getSendMailLangId($actionId, $mailAdress, $langId);
                 if ($objUser = \FWUser::getFWUserObject()->objUser->getUsers($filter = array('email' => $mailAdress, 'is_active' => true))) {
                     $userNick = $objUser->getUsername();
                     $userFirstname = $objUser->getProfileAttribute('firstname');
                     $userLastname = $objUser->getProfileAttribute('lastname');
                 } else {
                     $userNick = $mailAdress;
                     if (!empty($regId) && $mailAdress == $regMail) {
                         $userFirstname = $regFirstname;
                         $userLastname = $regLastname;
                     } else {
                         $userFirstname = '';
                         $userLastname = '';
                     }
                 }
                 $mailTitle = $this->mailList[$langId]['mail']->title;
                 $mailContentText = !empty($this->mailList[$langId]['mail']->content_text) ? $this->mailList[$langId]['mail']->content_text : strip_tags($this->mailList[$langId]['mail']->content_html);
                 $mailContentHtml = !empty($this->mailList[$langId]['mail']->content_html) ? $this->mailList[$langId]['mail']->content_html : $this->mailList[$langId]['mail']->content_text;
                 // actual language of selected e-mail template
                 $contentLanguage = $this->mailList[$langId]['lang_id'];
                 if ($actionId == self::MAIL_NOTFY_NEW_APP && $event->arrSettings['confirmFrontendEvents'] == 1) {
                     $eventLink = $domain . "/cadmin/index.php?cmd={$this->moduleName}&act=modify_event&id={$event->id}&confirm=1";
                 } else {
//.........这里部分代码省略.........
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:CalendarMailManager.class.php

示例12: sendMail

 function sendMail($entryId)
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG, $_CONFIG;
     //entrydata
     $objResult = $objDatabase->Execute("SELECT id, title, name, userid, email FROM " . DBPREFIX . "module_market WHERE id='" . contrexx_addslashes($entryId) . "' LIMIT 1");
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             $entryMail = $objResult->fields['email'];
             $entryName = $objResult->fields['name'];
             $entryTitle = $objResult->fields['title'];
             $entryUserid = $objResult->fields['userid'];
             $objResult->MoveNext();
         }
     }
     //assesuserdata
     $objResult = $objDatabase->Execute("SELECT email, username FROM " . DBPREFIX . "access_users WHERE id='" . $entryUserid . "' LIMIT 1");
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             // TODO: Never used
             //                $userMail            = $objResult->fields['email'];
             $userUsername = $objResult->fields['username'];
             $objResult->MoveNext();
         }
     }
     //get mail content n title
     $objResult = $objDatabase->Execute("SELECT title, content, active, mailcc FROM " . DBPREFIX . "module_market_mail WHERE id='1'");
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             $mailTitle = $objResult->fields['title'];
             $mailContent = $objResult->fields['content'];
             $mailCC = $objResult->fields['mailcc'];
             $mailOn = $objResult->fields['active'];
             $objResult->MoveNext();
         }
     }
     if ($mailOn == 1) {
         $array = explode('; ', $mailCC);
         $url = $_SERVER['SERVER_NAME'] . ASCMS_PATH_OFFSET;
         $link = "http://" . $url . "/index.php?section=Market&cmd=detail&id=" . $entryId;
         $now = date(ASCMS_DATE_FORMAT);
         //replase placeholder
         $array_1 = array('[[EMAIL]]', '[[NAME]]', '[[TITLE]]', '[[ID]]', '[[LINK]]', '[[URL]]', '[[DATE]]', '[[USERNAME]]');
         $array_2 = array($entryMail, $entryName, $entryTitle, $entryId, $link, $url, $now, $userUsername);
         for ($x = 0; $x < 8; $x++) {
             $mailTitle = str_replace($array_1[$x], $array_2[$x], $mailTitle);
         }
         for ($x = 0; $x < 8; $x++) {
             $mailContent = str_replace($array_1[$x], $array_2[$x], $mailContent);
         }
         //create mail
         $to = $entryMail;
         $fromName = $_CONFIG['coreAdminName'] . " - " . $url;
         $fromMail = $_CONFIG['coreAdminEmail'];
         $subject = $mailTitle;
         $message = $mailContent;
         if (\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
             $objMail = new \phpmailer();
             if ($_CONFIG['coreSmtpServer'] > 0) {
                 if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                     $objMail->IsSMTP();
                     $objMail->Host = $arrSmtp['hostname'];
                     $objMail->Port = $arrSmtp['port'];
                     $objMail->SMTPAuth = true;
                     $objMail->Username = $arrSmtp['username'];
                     $objMail->Password = $arrSmtp['password'];
                 }
             }
             $objMail->CharSet = CONTREXX_CHARSET;
             $objMail->SetFrom($fromMail, $fromName);
             $objMail->Subject = $subject;
             $objMail->IsHTML(false);
             $objMail->Body = $message;
             $objMail->AddAddress($to);
             $objMail->Send();
             $objMail->ClearAddresses();
             foreach ($array as $toCC) {
                 // Email message
                 if (!empty($toCC)) {
                     $objMail->AddAddress($toCC);
                     $objMail->Send();
                     $objMail->ClearAddresses();
                 }
             }
         }
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:86,代码来源:MarketLibrary.class.php

示例13: sendNotificationMail

 /**
  * send notification email
  *
  */
 function sendNotificationMail($fromId, $toId)
 {
     global $_CONFIG;
     if (@\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
         $objMail = new \phpmailer();
         if ($_CONFIG['coreSmtpServer'] > 0) {
             $objSmtpSettings = new SmtpSettings();
             if (($arrSmtp = $objSmtpSettings->getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                 $objMail->IsSMTP();
                 $objMail->Host = $arrSmtp['hostname'];
                 $objMail->Port = $arrSmtp['port'];
                 $objMail->SMTPAuth = true;
                 $objMail->Username = $arrSmtp['username'];
                 $objMail->Password = $arrSmtp['password'];
             }
         }
         $strName = $this->_getName($fromId);
         $strReceiverName = $this->_getName($toId);
         $toEmail = $this->_getEmail($toId);
         $from = $this->_getEmailFromDetails();
         $subject = $this->_getEmailSubjectDetails();
         $messageContent = $this->_getEmailMessageDetails();
         $strMailSubject = str_replace(array('[senderName]', '[receiverName]', '[domainName]'), array($strName['username'], $strReceiverName['username'], $_CONFIG['domainUrl']), $subject['subject']);
         $strMailBody = str_replace(array('[senderName]', '[receiverName]', '[domainName]'), array($strName['username'], $strReceiverName['username'], $_CONFIG['domainUrl']), $messageContent['email_message']);
         $objMail->CharSet = CONTREXX_CHARSET;
         $objMail->SetFrom($_CONFIG['coreAdminEmail'], $from['from']);
         $objMail->AddAddress($toEmail['email']);
         $objMail->Subject = $strMailSubject;
         //$strMailSubject;
         $objMail->IsHTML(true);
         $objMail->Body = $strMailBody;
         $objMail->Send();
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:38,代码来源:U2u.class.php

示例14: addComment


//.........这里部分代码省略.........
         return;
     }
     //Create validator-object
     $objValidator = new \FWValidator();
     //Get general-input
     $intMessageId = intval($_POST['frmAddComment_MessageId']);
     $strSubject = contrexx_addslashes(strip_tags($_POST['frmAddComment_Subject']));
     $strComment = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForDb($_POST['frmAddComment_Comment']);
     //Get specified-input
     if ($this->_intCurrentUserId == 0) {
         $intUserId = 0;
         $strName = contrexx_addslashes(strip_tags($_POST['frmAddComment_Name']));
         $strEMail = contrexx_addslashes(strip_tags($_POST['frmAddComment_EMail']));
         $strWWW = contrexx_addslashes(strip_tags($objValidator->getUrl($_POST['frmAddComment_WWW'])));
     } else {
         $intUserId = $this->_intCurrentUserId;
         $strName = '';
         $strEMail = '';
         $strWWW = '';
     }
     //Get options
     $intIsActive = intval($this->_arrSettings['blog_comments_autoactivate']);
     $intIsNotification = intval($this->_arrSettings['blog_comments_notification']);
     //Validate general-input
     if ($intMessageId <= 0) {
         $this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_MID']);
     }
     if (empty($strSubject)) {
         $this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_SUBJECT']);
     }
     if (empty($strComment)) {
         $this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_COMMENT']);
     }
     //Validate specified-input
     if ($this->_intCurrentUserId == 0) {
         if (empty($strName)) {
             $this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_NAME']);
         }
         if (!$objValidator->isEmail($strEMail)) {
             $this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_EMAIL']);
         }
     }
     $captchaCheck = true;
     if (!\FWUser::getFWUserObject()->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
         $captchaCheck = false;
     }
     //Now check error-string
     if (empty($this->_strErrorMessage) && $captchaCheck) {
         //No errors, insert entry
         $objDatabase->Execute(' INSERT INTO ' . DBPREFIX . 'module_blog_comments
                                 SET     message_id = ' . $intMessageId . ',
                                         lang_id = ' . $this->_intLanguageId . ',
                                         is_active = "' . $intIsActive . '",
                                         time_created = ' . time() . ',
                                         ip_address = "' . $_SERVER['REMOTE_ADDR'] . '",
                                         user_id = ' . $intUserId . ',
                                         user_name = "' . $strName . '",
                                         user_mail = "' . $strEMail . '",
                                         user_www = "' . $strWWW . '",
                                         subject = "' . $strSubject . '",
                                         comment = "' . $strComment . '"
                             ');
         //Set a cookie with the current timestamp. Avoids flooding.
         setcookie('BlogCommentLast', time(), 0, ASCMS_PATH_OFFSET . '/');
         $this->_strStatusMessage = $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_SUCCESS'];
         $this->writeCommentRSS();
         if ($intIsNotification) {
             //Send notification to administrator
             if (\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
                 $objMail = new \phpmailer();
                 if ($_CONFIG['coreSmtpServer'] > 0) {
                     if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                         $objMail->IsSMTP();
                         $objMail->Host = $arrSmtp['hostname'];
                         $objMail->Port = $arrSmtp['port'];
                         $objMail->SMTPAuth = true;
                         $objMail->Username = $arrSmtp['username'];
                         $objMail->Password = $arrSmtp['password'];
                     }
                 }
                 if ($this->_intCurrentUserId > 0) {
                     $objFWUser = \FWUser::getFWUserObject();
                     $strName = htmlentities($objFWUser->objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET);
                 }
                 $strMailSubject = str_replace('[SUBJECT]', $strSubject, $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_MAIL_SUBJECT']);
                 $strMailBody = str_replace('[USERNAME]', $strName, $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_MAIL_BODY']);
                 $strMailBody = str_replace('[DOMAIN]', ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET, $strMailBody);
                 $strMailBody = str_replace('[SUBJECT]', $strSubject, $strMailBody);
                 $strMailBody = str_replace('[COMMENT]', $strComment, $strMailBody);
                 $objMail->CharSet = CONTREXX_CHARSET;
                 $objMail->SetFrom($_CONFIG['coreAdminEmail'], $_CONFIG['coreGlobalPageTitle']);
                 $objMail->AddAddress($_CONFIG['coreAdminEmail']);
                 $objMail->Subject = $strMailSubject;
                 $objMail->IsHTML(false);
                 $objMail->Body = $strMailBody;
                 $objMail->Send();
             }
         }
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:Blog.class.php

示例15: sendMail

 /**
  * Send a confirmation e-mail to the address specified in the form,
  * if any.
  * @param $id
  * @param unknown_type $email
  * @return unknown
  */
 function sendMail($feedId, $email)
 {
     global $_CONFIG, $objDatabase, $_ARRAYLANG, $objInit;
     $feedId = intval($feedId);
     $languageId = null;
     // Get the user ID and entry information
     $objResult = $objDatabase->Execute("\n            SELECT addedby, title, language\n              FROM " . DBPREFIX . "module_directory_dir\n             WHERE id='{$feedId}'");
     if ($objResult && !$objResult->EOF) {
         $userId = $objResult->fields['addedby'];
         $feedTitle = $objResult->fields['title'];
         $languageId = $objResult->fields['language'];
     }
     // Get user data
     if (is_numeric($userId)) {
         $objFWUser = new \FWUser();
         if ($objFWUser->objUser->getUser($userId)) {
             $userMail = $objFWUser->objUser->getEmail();
             $userFirstname = $objFWUser->objUser->getProfileAttribute('firstname');
             $userLastname = $objFWUser->objUser->getProfileAttribute('lastname');
             $userUsername = $objFWUser->objUser->getUsername();
         }
     }
     if (!empty($email)) {
         $sendTo = $email;
         $mailId = 2;
     } else {
         // FIXED:  The mail addresses may *both* be empty!
         // Adding the entry was sucessful, however.  So we can probably assume
         // that it was a success anyway?
         // Added:
         if (empty($userMail)) {
             return true;
         }
         // ...and a boolean return value below.
         $sendTo = $userMail;
         $mailId = 1;
     }
     //get mail content n title
     $objResult = $objDatabase->Execute("\n            SELECT title, content\n              FROM " . DBPREFIX . "module_directory_mail\n             WHERE id='{$mailId}'");
     if ($objResult && !$objResult->EOF) {
         $subject = $objResult->fields['title'];
         $message = $objResult->fields['content'];
     }
     if ($objInit->mode == 'frontend') {
         $link = "http://" . $_CONFIG['domainUrl'] . CONTREXX_SCRIPT_PATH . "?section=Directory&cmd=detail&id=" . $feedId;
     } else {
         $link = "http://" . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/' . \FWLanguage::getLanguageParameter($languageId, 'lang') . '/' . CONTREXX_DIRECTORY_INDEX . "?section=Directory&cmd=detail&id=" . $feedId;
     }
     // replace placeholders
     $array_1 = array('[[USERNAME]]', '[[FIRSTNAME]]', '[[LASTNAME]]', '[[TITLE]]', '[[LINK]]', '[[URL]]', '[[DATE]]');
     $array_2 = array($userUsername, $userFirstname, $userLastname, $feedTitle, $link, $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET, date(ASCMS_DATE_FORMAT));
     $subject = str_replace($array_1, $array_2, $subject);
     $message = str_replace($array_1, $array_2, $message);
     $sendTo = explode(';', $sendTo);
     if (@\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
         $objMail = new \phpmailer();
         if ($_CONFIG['coreSmtpServer'] > 0 && @\Env::get('ClassLoader')->loadFile(ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
             $arrSmtp = SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer']);
             if ($arrSmtp !== false) {
                 $objMail->IsSMTP();
                 $objMail->Host = $arrSmtp['hostname'];
                 $objMail->Port = $arrSmtp['port'];
                 $objMail->SMTPAuth = true;
                 $objMail->Username = $arrSmtp['username'];
                 $objMail->Password = $arrSmtp['password'];
             }
         }
         $objMail->CharSet = CONTREXX_CHARSET;
         $objMail->SetFrom($_CONFIG['coreAdminEmail'], $_CONFIG['coreAdminName']);
         $objMail->Subject = $subject;
         $objMail->IsHTML(false);
         $objMail->Body = $message;
         foreach ($sendTo as $mailAdress) {
             $objMail->ClearAddresses();
             $objMail->AddAddress($mailAdress);
             $objMail->Send();
         }
     }
     return true;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:87,代码来源:DirectoryLibrary.class.php


注:本文中的phpmailer::SetFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。