• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Swift_Preferences类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: sendEmail

 /**
  * Send email using swift api.
  * 
  * @param $body
  * @param $recipients
  * @param $from
  * @param $subject
  */
 public function sendEmail($body, $recipients, $from, $subject)
 {
     $config = Zend_Registry::get('config');
     $failures = '';
     Swift_Preferences::getInstance()->setCharset('UTF-8');
     //Create the Transport
     $transport = Swift_SmtpTransport::newInstance($config->mail->server->name, $config->mail->server->port, $config->mail->server->security)->setUsername($config->mail->username)->setPassword($config->mail->password);
     $mailer = Swift_Mailer::newInstance($transport);
     $message = Swift_Message::newInstance();
     $headers = $message->getHeaders();
     $headers->addTextHeader("signed-by", Constant::EMAIL_DOMAIN);
     //Give the message a subject
     $message->setSubject($subject);
     //Set the From address with an associative array
     $message->setFrom($from);
     //Set the To addresses with an associative array
     $message->setTo($recipients);
     //Give it a body
     $message->setBody($body);
     $message->setContentType("text/html");
     //Send the message
     $myresult = $mailer->batchSend($message);
     if ($myresult) {
         return null;
     } else {
         return Constant::EMAIL_FAIL_MESSAGE;
     }
 }
开发者ID:BGCX262,项目名称:zufangzi-svn-to-git,代码行数:36,代码来源:SwiftEmail.php


示例2: setUp

 public function setUp()
 {
     $this->_attFileName = 'data.txt';
     $this->_attFileType = 'text/plain';
     $this->_attFile = __DIR__ . '/../../_samples/files/data.txt';
     Swift_Preferences::getInstance()->setCharset('utf-8');
 }
开发者ID:dosh93,项目名称:shop,代码行数:7,代码来源:Bug38Test.php


示例3: getInstance

 /**
  * Gets the instance of Preferences.
  *
  * @return Swift_Preferences
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:diandianxiyu,项目名称:Yii2Api,代码行数:12,代码来源:Preferences.php


示例4: testDotStuffingEncodingAndDecodingSamplesFromDiConfiguredInstance

 public function testDotStuffingEncodingAndDecodingSamplesFromDiConfiguredInstance()
 {
     // Enable DotEscaping
     Swift_Preferences::getInstance()->setQPDotEscape(true);
     $this->testEncodingAndDecodingSamplesFromDiConfiguredInstance();
     // Disable DotStuffing to continue
     Swift_Preferences::getInstance()->setQPDotEscape(false);
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:8,代码来源:QpContentEncoderAcceptanceTest.php


示例5: __construct

 /**
  *
  * @param \Swift_Transport $transport
  */
 public function __construct(\Zend_Config $webconfig)
 {
     $this->setWebconfig($webconfig);
     if (null === $transport) {
         $transport = $this->createTransport();
     }
     parent::__construct($transport);
     \Swift_Preferences::getInstance()->setCharset('iso-8859-1');
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:13,代码来源:Mailer.php


示例6: sendHtmlMail

 public function sendHtmlMail($from, $to, $subject, $body, $attachments = array())
 {
     spl_autoload_unregister(array('YiiBase', 'autoload'));
     Yii::import('application.extensions.swift.swift_required', true);
     spl_autoload_register(array('YiiBase', 'autoload'));
     Swift_Preferences::getInstance()->setCharset('utf-8');
     $message = Swift_Message::newInstance()->setSubject($subject)->setFrom($from)->setTo($to)->setBody($body, 'text/html');
     $transport = Swift_MailTransport::newInstance();
     $mailer = Swift_Mailer::newInstance($transport);
     return $mailer->batchSend($message);
 }
开发者ID:fobihz,项目名称:cndiesel,代码行数:11,代码来源:SwiftMailer.php


示例7: __construct

 /**
  * Swift初期化
  *
  * @param String $host
  * @param String $port
  * @param String $user
  * @param String $pass
  * @param String $charset
  * @return vold
  * @codeCoverageIgnore
  */
 public function __construct($host, $port, $user, $pass, $charset = 'iso-2022-jp')
 {
     $this->host = $host;
     $this->port = $port;
     $this->user = $user;
     $this->pass = $pass;
     $this->charset = $charset;
     $this->setPath();
     \Swift::init(function () use($charset) {
         \Swift_DependencyContainer::getInstance()->register('mime.qpheaderencoder')->asAliasOf('mime.base64headerencoder');
         \Swift_Preferences::getInstance()->setCharset($charset);
     });
 }
开发者ID:kobabasu,项目名称:yumenokousakusitsu-api,代码行数:24,代码来源:Init.php


示例8: _preferences

 protected function _preferences()
 {
     // Sets the default charset so that setCharset() is not needed elsewhere
     \Swift_Preferences::getInstance()->setCharset('utf-8');
     // Without these lines the default caching mechanism is "array" but this uses a lot of memory
     // If possible, use a disk cache to enable attaching large attachments etc.
     // You can override the default temporary directory by setting the TMPDIR environment variable.
     //        if (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir())) {
     //            \Swift_Preferences::getInstance()
     //                    ->setTempDir(sys_get_temp_dir())
     //                    ->setCacheType('disk');
     //        }
     \Swift_Preferences::getInstance()->setTempDir(self::getPathTmp())->setCacheType('disk');
     \Swift_Preferences::getInstance()->setQPDotEscape(false);
 }
开发者ID:eric-burel,项目名称:twentyparts,代码行数:15,代码来源:SwiftMailer.class.php


示例9: __construct

 /**
  * Load our Email setting from `app/config/email.php` over riding any values set in `app/config/dev.email.php` if the 
  * application is in `DEV_MODE`. 
  *
  *
  * @return void
  */
 public function __construct()
 {
     if (is_file(\App::path() . '/app/config/email.php')) {
         $this->settings = (require \App::path() . '/app/config/email.php');
     }
     //if
     if (\App::devMode()) {
         $devSettings = \App::path() . '/app/config/dev.email.php';
         if (is_file($devSettings)) {
             $this->settings = array_merge($this->settings, require $devSettings);
         }
         //if
     }
     //if
     $charset = $this->getSetting('CHARSET');
     if (!$charset) {
         $charset = 'iso-8859-2';
     }
     //if
     \Swift_Preferences::getInstance()->setCharset($charset);
 }
开发者ID:discophp,项目名称:framework,代码行数:28,代码来源:Email.class.php


示例10: swiftmailer_configurator

function swiftmailer_configurator()
{
    Swift_Preferences::getInstance()->setCharset(JsonApiApplication::$charset);
}
开发者ID:benshez,项目名称:DreamWeddingCeremomies,代码行数:4,代码来源:Email.php


示例11: mf_send_resume_link

function mf_send_resume_link($dbh, $form_name, $form_resume_url, $resume_email)
{
    global $mf_lang;
    //get settings first
    $mf_settings = mf_get_settings($dbh);
    $subject = sprintf($mf_lang['resume_email_subject'], $form_name);
    $email_content = sprintf($mf_lang['resume_email_content'], $form_name, $form_resume_url, $form_resume_url);
    $subject = utf8_encode($subject);
    //create the mail transport
    if (!empty($mf_settings['smtp_enable'])) {
        $s_transport = Swift_SmtpTransport::newInstance($mf_settings['smtp_host'], $mf_settings['smtp_port']);
        if (!empty($mf_settings['smtp_secure'])) {
            $s_transport->setEncryption('tls');
        }
        if (!empty($mf_settings['smtp_auth'])) {
            $s_transport->setUsername($mf_settings['smtp_username']);
            $s_transport->setPassword($mf_settings['smtp_password']);
        }
    } else {
        $s_transport = Swift_MailTransport::newInstance();
        //use PHP mail() transport
    }
    //create mailer instance
    $s_mailer = Swift_Mailer::newInstance($s_transport);
    if (file_exists($mf_settings['upload_dir'] . "/form_{$form_id}/files")) {
        Swift_Preferences::getInstance()->setCacheType('disk')->setTempDir($mf_settings['upload_dir'] . "/form_{$form_id}/files");
    }
    $from_name = html_entity_decode($mf_settings['default_from_name'], ENT_QUOTES);
    $from_email = $mf_settings['default_from_email'];
    if (!empty($resume_email) && !empty($form_resume_url)) {
        $s_message = Swift_Message::newInstance()->setCharset('utf-8')->setMaxLineLength(1000)->setSubject($subject)->setFrom(array($from_email => $from_name))->setSender($from_email)->setReturnPath($from_email)->setTo($resume_email)->setBody($email_content, 'text/html');
        //send the message
        $send_result = $s_mailer->send($s_message);
        if (empty($send_result)) {
            echo "Error sending email!";
        }
    }
}
开发者ID:habb0,项目名称:HabboPHP,代码行数:38,代码来源:helper-functions.php


示例12: job_run_archive

 /**
  * @param $job_object
  * @return bool
  */
 public function job_run_archive(&$job_object)
 {
     $job_object->substeps_todo = 1;
     $job_object->log(sprintf(__('%d. Try to send backup with email …', 'backwpup'), $job_object->steps_data[$job_object->step_working]['STEP_TRY']), E_USER_NOTICE);
     //check file Size
     if (!empty($job_object->job['emailefilesize'])) {
         if ($job_object->backup_filesize > $job_object->job['emailefilesize'] * 1024 * 1024) {
             $job_object->log(__('Backup archive too big to be sent by email!', 'backwpup'), E_USER_ERROR);
             $job_object->substeps_done = 1;
             return TRUE;
         }
     }
     $job_object->log(sprintf(__('Sending email to %s…', 'backwpup'), $job_object->job['emailaddress']), E_USER_NOTICE);
     //get mail settings
     $emailmethod = 'mail';
     $emailsendmail = '';
     $emailhost = '';
     $emailhostport = '';
     $emailsecure = '';
     $emailuser = '';
     $emailpass = '';
     if (empty($job_object->job['emailmethod'])) {
         //do so if i'm the wp_mail to get the settings
         global $phpmailer;
         // (Re)create it, if it's gone missing
         if (!is_object($phpmailer) || !$phpmailer instanceof PHPMailer) {
             require_once ABSPATH . WPINC . '/class-phpmailer.php';
             require_once ABSPATH . WPINC . '/class-smtp.php';
             $phpmailer = new PHPMailer(true);
         }
         //only if PHPMailer really used
         if (is_object($phpmailer)) {
             do_action_ref_array('phpmailer_init', array(&$phpmailer));
             //get settings from PHPMailer
             $emailmethod = $phpmailer->Mailer;
             $emailsendmail = $phpmailer->Sendmail;
             $emailhost = $phpmailer->Host;
             $emailhostport = $phpmailer->Port;
             $emailsecure = $phpmailer->SMTPSecure;
             $emailuser = $phpmailer->Username;
             $emailpass = $phpmailer->Password;
         }
     } else {
         $emailmethod = $job_object->job['emailmethod'];
         $emailsendmail = $job_object->job['emailsendmail'];
         $emailhost = $job_object->job['emailhost'];
         $emailhostport = $job_object->job['emailhostport'];
         $emailsecure = $job_object->job['emailsecure'];
         $emailuser = $job_object->job['emailuser'];
         $emailpass = BackWPup_Encryption::decrypt($job_object->job['emailpass']);
     }
     //Generate mail with Swift Mailer
     if (function_exists('mb_internal_encoding') && (int) ini_get('mbstring.func_overload') & 2) {
         $mbEncoding = mb_internal_encoding();
         mb_internal_encoding('ASCII');
     }
     try {
         //Set Temp dir for mailing
         Swift_Preferences::getInstance()->setTempDir(untrailingslashit(BackWPup::get_plugin_data('TEMP')))->setCacheType('disk');
         // Create the Transport
         if ($emailmethod == 'smtp') {
             $transport = Swift_SmtpTransport::newInstance($emailhost, $emailhostport);
             $transport->setUsername($emailuser);
             $transport->setPassword($emailpass);
             if ($emailsecure == 'ssl') {
                 $transport->setEncryption('ssl');
             }
             if ($emailsecure == 'tls') {
                 $transport->setEncryption('tls');
             }
         } elseif ($emailmethod == 'sendmail') {
             $transport = Swift_SendmailTransport::newInstance($emailsendmail);
         } else {
             $job_object->need_free_memory($job_object->backup_filesize * 8);
             $transport = Swift_MailTransport::newInstance();
         }
         // Create the Mailer using your created Transport
         $emailer = Swift_Mailer::newInstance($transport);
         // Create a message
         $message = Swift_Message::newInstance(sprintf(__('BackWPup archive from %1$s: %2$s', 'backwpup'), date_i18n('d-M-Y H:i', $job_object->start_time, TRUE), esc_attr($job_object->job['name'])));
         $message->setFrom(array($job_object->job['emailsndemail'] => $job_object->job['emailsndemailname']));
         $message->setTo(array($job_object->job['emailaddress']));
         $message->setBody(sprintf(__('Backup archive: %s', 'backwpup'), $job_object->backup_file), 'text/plain', strtolower(get_bloginfo('charset')));
         $message->attach(Swift_Attachment::fromPath($job_object->backup_folder . $job_object->backup_file, $job_object->get_mime_type($job_object->backup_folder . $job_object->backup_file)));
         // Send the message
         $result = $emailer->send($message);
     } catch (Exception $e) {
         $job_object->log('Swift Mailer: ' . $e->getMessage(), E_USER_ERROR);
     }
     if (isset($mbEncoding)) {
         mb_internal_encoding($mbEncoding);
     }
     if (isset($result) && !$result) {
         $job_object->log(__('Error while sending email!', 'backwpup'), E_USER_ERROR);
         return FALSE;
     } else {
//.........这里部分代码省略.........
开发者ID:mahassan,项目名称:shellneverknow,代码行数:101,代码来源:class-destination-email.php


示例13: catch

 */
try {
    ClassLoader::scanAndRegister();
} catch (UnresolvableDependenciesException $e) {
    die($e->getMessage());
    // see #6343
}
/**
 * Include the Composer autoloader
 */
require_once TL_ROOT . '/vendor/autoload.php';
/**
 * Override some SwiftMailer defaults
 */
Swift::init(function () {
    $preferences = Swift_Preferences::getInstance();
    if (!Config::get('useFTP')) {
        $preferences->setTempDir(TL_ROOT . '/system/tmp')->setCacheType('disk');
    }
    $preferences->setCharset(Config::get('characterSet'));
});
/**
 * Define the relative path to the installation (see #5339)
 */
if (file_exists(TL_ROOT . '/system/config/pathconfig.php') && TL_SCRIPT != 'contao/install.php') {
    define('TL_PATH', include TL_ROOT . '/system/config/pathconfig.php');
} elseif (TL_MODE == 'BE') {
    define('TL_PATH', preg_replace('/\\/contao\\/[a-z]+\\.php$/i', '', Environment::get('scriptName')));
} else {
    define('TL_PATH', null);
    // cannot be reliably determined
开发者ID:eknoes,项目名称:core,代码行数:31,代码来源:initialize.php


示例14: setUp

 public function setUp()
 {
     Swift_Preferences::getInstance()->setCharset('utf-8');
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:4,代码来源:Bug34Test.php


示例15:

<?php

require __DIR__ . '/../vendor/autoload.php';
\Swift::init(function () {
    \Swift_DependencyContainer::getInstance()->register('mime.qpheaderencoder')->asAliasOf('mime.base64headerencoder');
    \Swift_Preferences::getInstance()->setCharset('iso-2022-jp');
});
$message = \Swift_Message::newInstance()->setSubject('件名')->setFrom(['[email protected]' => 'テスト送信者'])->setTo(['[email protected]'])->setBody("メール本文です\n1234567890\nあいうえおかきくけko\n")->setCharset('iso-2022-jp')->setEncoder(new \Swift_Mime_ContentEncoder_PlainContentEncoder('7bit'));
$transport = \Swift_MailTransport::newInstance();
$mailer = \Swift_Mailer::newInstance($transport);
$mailer->send($message);
echo "sent\n";
开发者ID:uzulla,项目名称:pseudo_sendmail.php,代码行数:12,代码来源:test_send.php


示例16: send_email

function send_email($bcc_list, $subject, $bb_body, $reply_to = NULL, $prefix = NULL, $footer = NULL, $headers = NULL)
{
    global $EMAIL_ADDRESS, $EMAIL_USERNAME, $EMAIL_PASSWORD, $SMTP_SERVER, $SMTP_SERVER_PORT, $SMTP_SERVER_PROTOCOL, $LMT_EMAIL;
    require_once PATH::lib() . "/swiftmailer/swift_required.php";
    //Instead of using parameter default values, so we can pass NULL. And it's more readable.
    if (count($bcc_list) == 0) {
        return true;
    }
    if (is_null($reply_to)) {
        $reply_to = array($EMAIL_ADDRESS => 'LHS Math Club Mailbot');
    }
    if (is_null($prefix)) {
        $prefix = '[LHS Math Club]';
    }
    if (is_null($footer)) {
        $footer = "LHS Math Club\n[url]" . get_site_url() . "[/url]\nTo stop receiving LHSMATH emails, contact [email][email protected][/email].";
    }
    if (is_null($headers)) {
        $headers = array();
    }
    if (is_string($bcc_list)) {
        $bcc_list = array($bcc_list);
    }
    if (!is_array($bcc_list) || !is_string($subject) || !is_string($bb_body) || !is_array($reply_to) && !is_string($reply_to) || !is_string($prefix) || !is_string($footer) || !is_array($headers)) {
        return 'Invalid email parameters.';
    }
    if (($error_msg = val_email_msg($subject, $bb_body)) !== true) {
        return $error_msg;
    }
    if ($footer != "") {
        $bb_body .= "\n\n\n---\n{$footer}\n";
    }
    //Attach footer.
    $html = BBCode($bb_body);
    //BBCode it.
    $subject = preg_replace("/[^\\S ]/ui", '', strip_tags($prefix . ' ' . $subject));
    //"remove everything that's not [non-whitespace or space]"
    //preg_replace("/[^[:alnum][:space]]/ui", '', $string);?
    //Ok everything seems to be working, let's go ahead
    Swift_Preferences::getInstance()->setCacheType('array');
    //Prevents a ton of warnings about SwiftMail's DiskKeyCache, thus actually speeding things up considerably.
    //Connect to the SMTP server
    $transport = Swift_SmtpTransport::newInstance($SMTP_SERVER, $SMTP_SERVER_PORT, $SMTP_SERVER_PROTOCOL)->setUsername($EMAIL_USERNAME)->setPassword($EMAIL_PASSWORD);
    //Make a Mailer that will send through that transport (limiting to 50/send)
    $mailer = Swift_Mailer::newInstance($transport);
    //$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(50, 1));//Max 50 emails per send, 1 sec delay between sends
    try {
        //Mush all info into the Mailer
        $message = Swift_Message::newInstance($subject)->setFrom(array($EMAIL_ADDRESS => 'LHS Math Club Mailbot'))->setBcc($bcc_list)->setContentType("text/html")->setBody($html)->setReplyTo($reply_to);
        foreach ($headers as $field => $value) {
            //Add custom headers, such as listserv stuff.
            $message->getHeaders()->addTextHeader($field, $value);
        }
        //Send the message
        if (!$mailer->send($message)) {
            LOG::fatal('Error sending email');
        }
    } catch (Exception $e) {
        LOG::fatal('Email exception: ' . $e->getMessage());
    }
    return true;
}
开发者ID:lhsmath,项目名称:lhsmath.org,代码行数:62,代码来源:functions.mail.php


示例17: __construct

 /**
  * Initialize a new Swift_Message, set the subject and body.
  *
  * @param   string  message subject
  * @param   string  message body
  * @param   string  body mime type
  * @return  void
  */
 public function __construct($subject = null, $message = null, $type = null)
 {
     \Swift::init(function () {
         // Set the default character set for everything
         \Swift_Preferences::getInstance()->setCharset('utf-8');
     });
     // Create a new message, match internal character set
     $this->swiftmessage = \Swift_Message::newInstance();
     if ($subject) {
         // Apply subject
         $this->subject($subject);
     }
     if ($message) {
         // Apply message, with type
         $this->message($message, $type);
     }
 }
开发者ID:braf,项目名称:phalcana-email,代码行数:25,代码来源:Email.php


示例18:

<?php

Swift::init(function () {
    $charset = Kohana::$charset;
    // Set the default character set for everything
    Swift_Preferences::getInstance()->setCharset($charset);
});
开发者ID:woduda,项目名称:email,代码行数:7,代码来源:init.php


示例19: __construct

 /**
  * Class constructor
  */
 public function __construct(iPhorm $form)
 {
     parent::__construct($form);
     Swift_Preferences::setCharset($form->getCharset());
 }
开发者ID:Ramkumar05,项目名称:Renshiners,代码行数:8,代码来源:Email.php


示例20: edit_ajax

 /**
  * sends test mail
  */
 public function edit_ajax()
 {
     check_ajax_referer('backwpup_ajax_nonce');
     //get mail settings
     $emailmethod = 'mail';
     $emailsendmail = '';
     $emailhost = '';
     $emailhostport = '';
     $emailsecure = '';
     $emailuser = '';
     $emailpass = '';
     if (empty($_POST['emailmethod'])) {
         //do so if i'm the wp_mail to get the settings
         global $phpmailer;
         // (Re)create it, if it's gone missing
         if (!is_object($phpmailer) || !$phpmailer instanceof PHPMailer) {
             require_once ABSPATH . WPINC . '/class-phpmailer.php';
             require_once ABSPATH . WPINC . '/class-smtp.php';
             $phpmailer = new PHPMailer(true);
         }
         //only if PHPMailer really used
         if (is_object($phpmailer)) {
             do_action_ref_array('phpmailer_init', array(&$phpmailer));
             //get settings from PHPMailer
             $emailmethod = $phpmailer->Mailer;
             $emailsendmail = $phpmailer->Sendmail;
             $emailhost = $phpmailer->Host;
             $emailhostport = $phpmailer->Port;
             $emailsecure = $phpmailer->SMTPSecure;
             $emailuser = $phpmailer->Username;
             $emailpass = $phpmailer->Password;
         }
     } else {
         $emailmethod = $_POST['emailmethod'];
         $emailsendmail = $_POST['emailsendmail'];
         $emailhost = $_POST['emailhost'];
         $emailhostport = $_POST['emailhostport'];
         $emailsecure = $_POST['emailsecure'];
         $emailuser = $_POST['emailuser'];
         $emailpass = BackWPup_Encryption::decrypt($_POST['emailpass']);
     }
     //Generate mail with Swift Mailer
     if (function_exists('mb_internal_encoding') && (int) ini_get('mbstring.func_overload') & 2) {
         $mbEncoding = mb_internal_encoding();
         mb_internal_encoding('ASCII');
     }
     try {
         //Set Temp dir for mailing
         Swift_Preferences::getInstance()->setTempDir(untrailingslashit(BackWPup::get_plugin_data('TEMP')))->setCacheType('disk');
         // Create the Transport
         if ($emailmethod == 'smtp') {
             $transport = Swift_SmtpTransport::newInstance($emailhost, $emailhostport);
             $transport->setUsername($emailuser);
             $transport->setPassword($emailpass);
             if ($emailsecure == 'ssl') {
                 $transport->setEncryption('ssl');
             }
             if ($emailsecure == 'tls') {
                 $transport->setEncryption('tls');
             }
         } elseif ($emailmethod == 'sendmail') {
             $transport = Swift_SendmailTransport::newInstance($emailsendmail);
         } else {
             $transport = Swift_MailTransport::newInstance();
         }
         // Create the Mailer using your created Transport
         $emailer = Swift_Mailer::newInstance($transport);
         // Create a message
         $message = Swift_Message::newInstance(__('BackWPup archive sending TEST Message', 'backwpup'));
         $message->setFrom(array($_POST['emailsndemail'] => isset($_POST['emailsndemailname']) ? $_POST['emailsndemailname'] : ''));
         $message->setTo(array($_POST['emailaddress']));
         $message->setBody(__('If this message reaches your inbox, sending backup archives via email should work for you.', 'backwpup'));
         // Send the message
         $result = $emailer->send($message);
     } catch (Exception $e) {
         echo '<span id="emailsendtext" style="color:red;">Swift Mailer: ' . $e->getMessage() . '</span>';
     }
     if (isset($mbEncoding)) {
         mb_internal_encoding($mbEncoding);
     }
     if (!isset($result) || !$result) {
         echo '<span id="emailsendtext" style="color:red;">' . __('Error while sending email!', 'backwpup') . '</span>';
     } else {
         echo '<span id="emailsendtext" style="color:green;">' . __('Email sent.', 'backwpup') . '</span>';
     }
     die;
 }
开发者ID:congtrieu112,项目名称:anime,代码行数:90,代码来源:class-destination-email.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Swift_RecipientList类代码示例发布时间:2022-05-23
下一篇:
PHP Swift_OutputByteStream类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap