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


PHP SMTP::Send方法代码示例

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


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

示例1: send_email

function send_email($goingto, $toname, $sbj, $messg)
{
    global $Config;
    define('DISPLAY_XPM4_ERRORS', true);
    // display XPM4 errors
    $core_em = $Config->get('site_email');
    // If email type "0" (SMTP)
    if ($Config->get('email_type') == 0) {
        require_once 'core/mail/SMTP.php';
        // path to 'SMTP.php' file from XPM4 package
        $f = '' . $core_em . '';
        // from mail address
        $t = '' . $goingto . '';
        // to mail address
        // standard mail message RFC2822
        $m = 'From: ' . $f . "\r\n" . 'To: ' . $t . "\r\n" . 'Subject: ' . $sbj . "\r\n" . 'Content-Type: text/plain' . "\r\n\r\n" . '' . $messg . '';
        $h = explode('@', $t);
        // get client hostname
        $c = SMTP::MXconnect($h[1]);
        // connect to SMTP server (direct) from MX hosts list
        $s = SMTP::Send($c, array($t), $m, $f);
        // send mail
        // print result
        if ($s) {
            output_message('success', 'Mail Sent!');
        } else {
            output_message('error', print_r($_RESULT));
        }
        SMTP::Disconnect($c);
        // disconnect
    } elseif ($Config->get('email_type') == 1) {
        require_once 'core/mail/MIME.php';
        // path to 'MIME.php' file from XPM4 package
        // compose message in MIME format
        $mess = MIME::compose($messg);
        // send mail
        $send = mail($goingto, $sbj, $mess['content'], 'From: ' . $core_em . '' . "\n" . $mess['header']);
        // print result
        echo $send ? output_message('success', 'Mail Sent!') : output_message('error', 'Error!');
    } elseif ($Config->get('email_type') == 2) {
        require_once 'core/mail/MAIL.php';
        // path to 'MAIL.php' file from XPM4 package
        $m = new MAIL();
        // initialize MAIL class
        $m->From($core_em);
        // set from address
        $m->AddTo($goingto);
        // add to address
        $m->Subject($sbj);
        // set subject
        $m->Html($messg);
        // set html message
        // connect to MTA server 'smtp.hostname.net' port '25' with authentication: 'username'/'password'
        if ($Config->get('email_use_secure') == 1) {
            $c = $m->Connect($Config->get('email_smtp_host'), $Config->get('email_smtp_port'), $Config->get('email_smtp_user'), $Config->get('email_smtp_pass'), $Config->get('email_smtp_secure')) or die(print_r($m->Result));
        } else {
            $c = $m->Connect($Config->get('email_smtp_host'), $Config->get('email_smtp_port'), $Config->get('email_smtp_user'), $Config->get('email_smtp_pass')) or die(print_r($m->Result));
        }
        // send mail relay using the '$c' resource connection
        echo $m->Send($c) ? output_message('success', 'Mail Sent!') : output_message('error', 'Error! Please check your config and make sure you inserted your MTA info correctly.');
        $m->Disconnect();
        // disconnect from server
        // print_r($m->History); // optional, for debugging
    }
}
开发者ID:louisnorthmore,项目名称:mangoswebv3,代码行数:65,代码来源:common.php

示例2: sendMail

 public function sendMail($assunto, $mensagem, $email_para = null)
 {
     $dados_envio = $this->configuracoesGerais(array('email_destinatario', 'email_remetente_host', 'email_remetente', 'email_remetente_senha'));
     //DADOS SMTP
     if (!empty($dados_envio)) {
         $smtp = $dados_envio['Configuracao']['email_remetente_host'];
         $usuario = $dados_envio['Configuracao']['email_remetente'];
         $senha = $dados_envio['Configuracao']['email_remetente_senha'];
         if ($email_para == null) {
             $email_para = $dados_envio['Configuracao']['email_destinatario'];
         }
     } else {
         $smtp = "smtp.zoio.net.br";
         $usuario = "tester@zoio.net.br";
         $senha = "zoio2010";
         if ($email_para == null) {
             $email_para = 'zoiodev@zoio.net.br';
         }
     }
     $email_de = $usuario;
     require_once './smtp/smtp.php';
     $mail = new SMTP();
     $mail->Delivery('relay');
     $mail->Relay($smtp, $usuario, $senha, 587, 'login', false);
     //$mail->addheader('content-type', 'text/html; charset=utf-8');
     //$mail->addheader('content-type', 'text/html; charset=iso-8859-1');
     $mail->TimeOut(10);
     $mail->Priority('normal');
     $mail->From($email_de);
     $mail->AddTo($email_para);
     //$mail->AddBcc('zoiodev@zoio.net.br');
     $mail->Html($mensagem);
     if ($mail->Send($assunto)) {
         //echo '_SMTP+_Enviou para g......@zoio.net.br';
         return true;
     } else {
         //echo '_SMTP+_Não enviou e-mail';
         return false;
     }
 }
开发者ID:indirasam,项目名称:aquitemmata,代码行数:40,代码来源:AppController.php

示例3: error_reporting

error_reporting(E_ALL);
// php errors
define('DISPLAY_XPM4_ERRORS', true);
// display XPM4 errors
// path to 'POP3.php' and 'SMTP.php' files from XPM4 package
require_once '../POP3.php';
require_once '../SMTP.php';
$f = 'username@hostname.net';
// from mail address / account username
$t = 'client@destination.net';
// to mail address
$p = 'password';
// account password
// standard mail message RFC2822
$m = 'From: ' . $f . "\r\n" . 'To: ' . $t . "\r\n" . 'Subject: test' . "\r\n" . 'Content-Type: text/plain' . "\r\n\r\n" . 'Text message.';
// connect to 'pop3.hostname.net' POP3 server address with authentication username '$f' and password '$p'
$p = POP3::Connect('pop3.hostname.net', $f, $p) or die(print_r($_RESULT));
// connect to 'smtp.hostname.net' SMTP server address
$c = SMTP::Connect('smtp.hostname.net') or die(print_r($_RESULT));
// send mail
$s = SMTP::Send($c, array($t), $m, $f);
// print result
if ($s) {
    echo 'Sent !';
} else {
    print_r($_RESULT);
}
// disconnect from SMTP server
SMTP::Disconnect($c);
// disconnect from POP3 server
POP3::Disconnect($p);
开发者ID:jasarjasu786,项目名称:duitasuo,代码行数:31,代码来源:pop3-smtp.php

示例4: send_email

function send_email($to_email, $to_name, $theme, $text_text, $text_html = '')
{
    global $config;
    if (!$config['smtp_adress']) {
        output_message('alert', 'Set SMTP settings in config !');
        return false;
    }
    if (!$to_email) {
        output_message('alert', 'Field "to" is empty.');
        return false;
    }
    set_time_limit(300);
    require_once 'core/mail/smtp.php';
    $mail = new SMTP();
    $mail->Delivery('relay');
    $mail->Relay($config['smtp_adress'], $config['smtp_username'], $config['smtp_password']);
    $mail->From($config['site_email'], $config['base_href']);
    $mail->AddTo($to_email, $to_name);
    $mail->Text($text_text);
    if ($text_html) {
        $mail->Html($text_html);
    }
    $sent = $mail->Send($theme);
    return $sent;
}
开发者ID:space77,项目名称:mwfv3_sp,代码行数:25,代码来源:common.php

示例5: send_email

function send_email($to_email, $to_name, $theme, $text_text, $text_html = '')
{
    global $MW;
    if (!(string) $MW->getConfig->generic->smtp_adress) {
        output_message('alert', 'Set SMTP settings in config !');
        return false;
    }
    if (!$to_email) {
        output_message('alert', 'Field "to" is empty.');
        return false;
    }
    set_time_limit(300);
    include 'core/mail/smtp.php';
    $mail = new SMTP();
    $mail->Delivery('relay');
    $mail->Relay((string) $MW->getConfig->generic->smtp_adress, (string) $MW->getConfig->generic->smtp_username, (string) $MW->getConfig->generic->smtp_password);
    $mail->From((string) $MW->getConfig->generic->site_email, (string) $MW->getConfig->generic->site_title);
    $mail->AddTo($to_email, $to_name);
    $mail->Text($text_text);
    if ($text_html) {
        $mail->Html($text_html);
    }
    $sent = $mail->Send($theme);
    return $sent;
}
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:25,代码来源:common.php


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