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


PHP Mail::sendMailTest方法代码示例

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


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

示例1: ajaxProcessSendMailTest

 public function ajaxProcessSendMailTest()
 {
     if ($this->tabAccess['view'] === '1') {
         $smtpChecked = trim(Tools::getValue('mailMethod')) == 'smtp';
         $smtpServer = Tools::getValue('smtpSrv');
         $content = urldecode(Tools::getValue('testMsg'));
         $content = utf8_encode(html_entity_decode($content));
         $subject = urldecode(Tools::getValue('testSubject'));
         $type = 'text/html';
         $to = Tools::getValue('testEmail');
         $from = Configuration::get('PS_SHOP_EMAIL');
         $smtpLogin = Tools::getValue('smtpLogin');
         $smtpPassword = Tools::getValue('smtpPassword');
         $smtpPassword = !empty($smtpPassword) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD');
         $smtpPort = Tools::getValue('smtpPort');
         $smtpEncryption = Tools::getValue('smtpEnc');
         $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
         die($result === true ? 'ok' : $result);
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:20,代码来源:AdminEmailsController.php

示例2: die

*  @author Dream me up
*  @copyright  2011 Mailjet SAS
*  @license    hhttp://opensource.org/licenses/mit-license  MIT License
*  International Registred Trademark & Property of Mailjet SAS
*/
require '../../config/config.inc.php';
require 'mailjet.php';
if (Tools::getValue('token') == '' || Tools::getValue('token') != Configuration::get('MAILJET_AJAX_TOKEN')) {
    die('Invalid Token');
}
$obj_mailjet = new Mailjet();
$email_from = urldecode($_GET['email_from']);
try {
    $sujet = $obj_mailjet->l('Mailjet Test E-mail');
    $message = $obj_mailjet->l('Hello') . ",\r\n\r\n" . $obj_mailjet->l('This E-mail confirms you that Mailjet has successfully been installed on your shop.');
    $result = Mail::sendMailTest(true, "in.mailjet.com", $message, $sujet, "text/plain", $email_from, $email_from, $_GET['mailjet_api_key'], $_GET['mailjet_secret_key'], $smtpPort = 465, "tls");
    if ($result === true) {
        echo "true";
    } else {
        if ($result == 999) {
            $result = $obj_mailjet->l('The E-mail was not successfully sent');
        }
        echo "false|" . $result;
        reset_config_mailjet();
    }
} catch (Exception $e) {
    echo "false|" . $e->getMessage();
    reset_config_mailjet();
}
function reset_config_mailjet()
{
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:31,代码来源:ajax.php

示例3: dirname

* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include_once dirname(__FILE__) . '/../config/config.inc.php';
/* Getting cookie or logout */
require_once dirname(__FILE__) . '/init.php';
$smtpChecked = trim($_POST['mailMethod']) == 'smtp';
$smtpServer = $_POST['smtpSrv'];
$content = urldecode($_POST['testMsg']);
$subject = urldecode($_POST['testSubject']);
$type = 'text/html';
$to = $_POST['testEmail'];
$from = Configuration::get('PS_SHOP_EMAIL');
$smtpLogin = $_POST['smtpLogin'];
$smtpPassword = urldecode($_POST['smtpPassword']);
$smtpPort = $_POST['smtpPort'];
$smtpEncryption = $_POST['smtpEnc'];
$result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
die($result === true ? 'ok' : $result);
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:31,代码来源:ajax_send_mail_test.php

示例4: ajaxProcessSendMailTest

 public function ajaxProcessSendMailTest()
 {
     /* PrestaShop demo mode */
     if (_PS_MODE_DEMO_) {
         die(Tools::displayError('This functionality has been disabled.'));
     }
     /* PrestaShop demo mode */
     if ($this->tabAccess['view'] === '1') {
         $smtpChecked = trim(Tools::getValue('mailMethod')) == 'smtp';
         $smtpServer = Tools::getValue('smtpSrv');
         $content = urldecode(Tools::getValue('testMsg'));
         $content = html_entity_decode($content);
         $subject = urldecode(Tools::getValue('testSubject'));
         $type = 'text/html';
         $to = Tools::getValue('testEmail');
         $from = Configuration::get('PS_SHOP_EMAIL');
         $smtpLogin = Tools::getValue('smtpLogin');
         $smtpPassword = Tools::getValue('smtpPassword');
         $smtpPassword = !empty($smtpPassword) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD');
         $smtpPassword = str_replace(array('&lt;', '&gt;', '&quot;', '&amp;'), array('<', '>', '"', '&'), Tools::htmlentitiesUTF8($smtpPassword));
         $smtpPort = Tools::getValue('smtpPort');
         $smtpEncryption = Tools::getValue('smtpEnc');
         $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), $smtpPassword, Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
         die($result === true ? 'ok' : $result);
     }
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:26,代码来源:AdminEmailsController.php

示例5: dirname

<?php

include_once dirname(__FILE__) . '/../config/config.inc.php';
/* Getting cookie or logout */
require_once dirname(__FILE__) . '/init.php';
$smtpChecked = trim($_GET['mailMethod']) == 'smtp';
$smtpServer = $_GET['smtpSrv'];
$content = $_GET['testMsg'];
$subject = $_GET['testSubject'];
$type = 'text/html';
$to = $_GET['testEmail'];
$from = 'no-reply@' . Tools::getHttpHost(false, true) . '.com';
$smtpLogin = $_GET['smtpLogin'];
$smtpPassword = $_GET['smtpPassword'];
$smtpPort = $_GET['smtpPort'];
$smtpEncryption = $_GET['smtpEnc'];
$result = Mail::sendMailTest($smtpChecked, $smtpServer, $content, $subject, $type, $to, $from, $smtpLogin, $smtpPassword, $smtpPort, $smtpEncryption);
die($result ? 'ok' : 'fail');
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:18,代码来源:ajax_send_mail_test.php

示例6: _postProcessConfiguration

 private function _postProcessConfiguration()
 {
     $employee = new Employee((int) Context::getContext()->cookie->id_employee);
     Configuration::updateValue('MAILJET_API_KEY', pSQL(Tools::getValue('mailjet_api_key')));
     Configuration::updateValue('MAILJET_SECRET_KEY', pSQL(Tools::getValue('mailjet_secret_key')));
     // If mailjet activation, let's configure
     if ((int) Tools::getValue('mailjet_activation') == 1) {
         // Test multiple configuration
         $configTab = array(array('server' => 'in.mailjet.com', 'port' => 465, 'protocol' => 'tls'), array('server' => 'in.mailjet.com', 'port' => 465, 'protocol' => 'ssl'), array('server' => 'in.mailjet.com', 'port' => 587, 'protocol' => 'tcp'), array('server' => 'in-v4.mailjet.com', 'port' => 465, 'protocol' => 'ssl'), array('server' => 'in-v4.mailjet.com', 'port' => 588, 'protocol' => 'tcp'));
         $result = false;
         $email = $employee->email;
         $subject = $this->l('Mailjet Test E-mail');
         $message = $this->l('Hello') . ",\r\n\r\n" . $this->l('This E-mail confirms you that Mailjet has successfully been installed on your shop.');
         foreach ($configTab as $config) {
             if ($result !== true) {
                 $result = Mail::sendMailTest(true, $config['server'], $message, $subject, "text/plain", $email, $email, Configuration::get('MAILJET_API_KEY'), Configuration::get('MAILJET_SECRET_KEY'), $config['port'], $config['protocol']);
                 if ($result === true) {
                     Configuration::updateValue('MAILJET_ACTIVATE', (int) Tools::getValue('mailjet_activation'));
                     Configuration::updateValue('PS_MAIL_METHOD', 2);
                     Configuration::updateValue('PS_MAIL_SERVER', pSQL($config['server']));
                     Configuration::updateValue('PS_MAIL_USER', pSQL(Configuration::get('MAILJET_API_KEY')));
                     Configuration::updateValue('PS_MAIL_PASSWD', pSQL(Configuration::get('MAILJET_SECRET_KEY')));
                     Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', pSQL($config['protocol']));
                     Configuration::updateValue('PS_MAIL_SMTP_PORT', pSQL($config['port']));
                     $this->_html .= $this->displayConfirmation($this->l('Settings updated'));
                 }
             }
         }
         if ($result !== true) {
             $this->_html .= $this->displayError($this->l('Settings failed'));
         }
     } else {
         Configuration::updateValue('PS_MAIL_METHOD', 1);
         Configuration::updateValue('PS_MAIL_SERVER', "");
         Configuration::updateValue('PS_MAIL_USER', "");
         Configuration::updateValue('PS_MAIL_PASSWD', "");
         Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', "");
         Configuration::updateValue('PS_MAIL_SMTP_PORT', 25);
     }
 }
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:40,代码来源:mailjet.php

示例7: smcf_send

 function smcf_send($name, $phone, $subject, $message, $cc)
 {
     include_once _PS_SWIFT_DIR_ . 'Swift.php';
     // Filter and validate fields
     $name = $this->smcf_filter($name);
     $subject = $this->smcf_filter($subject);
     $phone = $this->smcf_filter($phone);
     if (!$this->smcf_validate_phone($phone)) {
         $subject .= " - Warning!: CALL-BACK!";
         $message .= "\n\nНомер телефона: " . $phone;
         $phone = $to;
         $cc = 0;
         // do not CC "sender"
     }
     // Add additional info to the message
     if ($this->extra["ip"]) {
         $message .= "\n\nIP: " . $_SERVER["REMOTE_ADDR"];
     }
     if ($this->extra["user_agent"]) {
         $message .= "\n\nUSER AGENT: " . $_SERVER["HTTP_USER_AGENT"];
     }
     // Set and wordwrap message body
     $body = "Имя: {$name}\n\n";
     $body .= " Телефон: {$phone}\n\n";
     $body .= " Сообщение: {$message}";
     $body = wordwrap($body, 70);
     // Build header
     $headers = "From: {$phone}\n";
     if ($cc == 1) {
         $headers .= "Cc: {$phone}\n";
     } else {
         // you need to enable mb_encode_mimeheader or risk
         // getting phones that are not UTF-8 encoded
     }
     $headers .= "MIME-Version: 1.0\n";
     $headers .= "Content-type: text/plain; charset=utf-8\n";
     $headers .= "Content-Transfer-Encoding: quoted-printable\n";
     // Send phone
     $configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_SMTP_ENCRYPTION', 'PS_MAIL_SMTP_PORT', 'PS_MAIL_METHOD', 'PS_MAIL_TYPE'));
     if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION'])) {
         $configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';
     }
     if (!isset($configuration['PS_MAIL_SMTP_PORT'])) {
         $configuration['PS_MAIL_SMTP_PORT'] = 25;
     }
     $fromName = $phone;
     if (!isset($from)) {
         $from = $configuration['PS_SHOP_EMAIL'];
     }
     if (!isset($fromName)) {
         $fromName = $configuration['PS_SHOP_NAME'];
     }
     $from = new Swift_Address($from, $fromName);
     $smtpChecked = $configuration['PS_MAIL_METHOD'] == 2;
     $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($configuration['PS_MAIL_SERVER']), Tools::htmlentitiesUTF8($body), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8('text/html'), Tools::htmlentitiesUTF8($this->to), $from, Tools::htmlentitiesUTF8($configuration['PS_MAIL_USER']), Tools::htmlentitiesUTF8($configuration['PS_MAIL_PASSWD']), Tools::htmlentitiesUTF8($configuration['PS_MAIL_SMTP_PORT']), Tools::htmlentitiesUTF8($configuration['PS_MAIL_SMTP_ENCRYPTION']));
     if (!$result) {
         echo $this->display(__FILE__, 'callback_die.tpl');
     }
     //die($result ? '' : echo $this->display(__FILE__, 'callback_die.tpl'));
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:60,代码来源:callback.php


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