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


PHP SMTP::disconnect方法代码示例

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


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

示例1: relay

   - send mail relay (using Gmail MTA) with authentication via SSL conection (TLS encryption)
*/
// manage errors
error_reporting(E_ALL);
// php errors
define('DISPLAY_XPM4_ERRORS', true);
// display XPM4 errors
// path to 'SMTP.php' file from XPM4 package
require_once '../SMTP.php';
$f = 'username@gmail.com';
// from (Gmail mail address)
$t = 'client@destination.net';
// to mail address
$p = 'password';
// Gmail 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 MTA server (relay) 'smtp.gmail.com' via SSL (TLS encryption) with authentication using port '465' and timeout '10' secounds
// make sure you have OpenSSL module (extension) enable on your php configuration
$c = SMTP::connect('smtp.gmail.com', 465, $f, $p, 'tls', 10) or die(print_r($_RESULT));
// send mail relay
$s = SMTP::send($c, array($t), $m, $f);
// print result
if ($s) {
    echo 'Sent !';
} else {
    print_r($_RESULT);
}
// disconnect
SMTP::disconnect($c);
开发者ID:jasarjasu786,项目名称:duitasuo,代码行数:30,代码来源:smtp-relay.php

示例2: explode

// to mail address
$subj = 'Hello World!';
// mail subject
$text = 'Text version of message.';
// text/plain version of message
$html = '<b>HTML</b> version of <u>message</u>.';
// text/html version of message
// CONFIGURATION ------------------
// set text/plain version of message
$msg1 = MIME::message($text, 'text/plain');
// set text/html version of message
$msg2 = MIME::message($html, 'text/html');
// compose message in MIME format
$mess = MIME::compose($msg1, $msg2);
// standard mail message RFC2822
$body = 'From: ' . $from . "\r\n" . 'To: ' . $to . "\r\n" . 'Subject: ' . $subj . "\r\n" . $mess['header'] . "\r\n\r\n" . $mess['content'];
// get client hostname
$expl = explode('@', $to);
// connect to SMTP server (direct) from MX hosts list
$conn = SMTP::mxconnect($expl[1]) or die(print_r($_RESULT));
// send mail
$sent = SMTP::send($conn, array($to), $body, $from);
// print result
if ($sent) {
    echo 'Sent !';
} else {
    print_r($_RESULT);
}
// disconnect from SMTP server
SMTP::disconnect($conn);
开发者ID:jasarjasu786,项目名称:duitasuo,代码行数:30,代码来源:mime-smtp.php

示例3: send_mail

function send_mail($mailto, $subject, $content, $sender_name = null, $sender_address = null)
{
    //        $subject=iconv("UTF-8", "EUC-KR", $subject);
    //        $content=iconv("UTF-8", "EUC-KR", $content);
    if (!$sender_name) {
        $settings = new Settings();
        $sender_name = $settings->default_mail_sender_name;
        //$settings->default_mail_sender_address;
    }
    //return mailer ($from, $fname, $to, $cc, $bcc, $subject, $content, $file, $type, $charset, $textencode)
    $smtp_server = "uwa64-001.cafe24.com";
    $smtp_user = "admin";
    $smtp_passwd = "ok1234";
    $sender_address = "admin@trail.or.kr";
    $boundary = "___==MultiPart_" . strtoupper(md5(uniqid(rand()))) . "==___";
    $smtp_server = "smtp.gmail.com";
    $smtp_user = "binseop@gmail.com";
    $smtp_passwd = "ok123456";
    $sender_address = "binseop@gmail.com";
    $smtp_sock = fsockopen($smtp_server, 25);
    /*
    fputs($smtp_sock, "HELO $smtp_server\r\n");
    fputs($smtp_sock, "VRFY $smtp_user\r\n");
    fputs($smtp_sock, "MAIL FROM:$sender_address\r\n");
    fputs($smtp_sock, "RCPT TO:$mailto\r\n");
    fputs($smtp_sock, "DATA\r\n");
    fputs($smtp_sock, "From: $sender_name<$sender_address>\r\n");
    fputs($smtp_sock, "To: $mailto\r\n");
    fputs($smtp_sock, "X-Mailer: miplus\r\n");
    fputs($smtp_sock, "Content-Type: text/html;");
    fputs($smtp_sock, "charset=UTF-8\r\n");
    fputs($smtp_sock, "MIME-Version: 1.0\r\n");
    fputs($smtp_sock, "Subject: $subject\r\n\r\n");
    fputs($smtp_sock, $content);
    fputs($smtp_sock, "\r\n\r\n.\r\nQUIT\r\n");
    */
    //include_once ("../../app/XPM/smtp.php");
    require_once "../../app/XPM/SMTP.php";
    $f = "auth@myjirisan.org";
    $t = $mailto;
    $p = "trail1";
    $c = $content;
    $m = 'From: ' . $f . "\r\n" . 'To: ' . $t . "\r\n" . 'Subject: ' . $subject . "\r\n" . 'Content-Type: text/html' . "\r\n\r\n" . $content;
    // connect to MTA server (relay) 'smtp.gmail.com' via SSL (TLS encryption) with authentication using port '465' and timeout '10' secounds
    // make sure you have OpenSSL module (extension) enable on your php configuration
    $c = SMTP::connect('smtp.gmail.com', 465, $f, $p, 'tls', 10) or die(print_r($_RESULT));
    // send mail relay
    $s = SMTP::send($c, array($t), $m, $f);
    /*
    // print result
    if ($s) echo 'Sent !';
    else print_r($_RESULT);
    */
    // disconnect
    SMTP::disconnect($c);
}
开发者ID:byyeong,项目名称:dc2016,代码行数:56,代码来源:utils.php


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