本文整理匯總了PHP中smtp::smtp_sockopen方法的典型用法代碼示例。如果您正苦於以下問題:PHP smtp::smtp_sockopen方法的具體用法?PHP smtp::smtp_sockopen怎麽用?PHP smtp::smtp_sockopen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類smtp
的用法示例。
在下文中一共展示了smtp::smtp_sockopen方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendmail
function sendmail($email, $mailtitle, $mailbody)
{
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_user, $cfg_smtp_password, $cfg_adminemail, $cfg_webname;
if ($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) {
$mailtype = 'HTML';
require_once DEDEINC . '/mail.class.php';
$smtp = new smtp($cfg_smtp_server, $cfg_smtp_port, true, $cfg_smtp_usermail, $cfg_smtp_password);
$smtp->debug = false;
if (!$smtp->smtp_sockopen($cfg_smtp_server)) {
ShowMsg('郵件發送失敗,請聯係管理員', '-1');
exit;
}
$smtp->sendmail($email, $cfg_webname, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
} else {
@mail($email, $mailtitle, $mailbody, $headers);
}
}
示例2: smtp
$userhash = md5($cfg_cookie_encode . '--' . $cfg_ml->fields['mid'] . '--' . $cfg_ml->fields['email']);
$url = $cfg_basehost . (empty($cfg_cmspath) ? '/' : $cfg_cmspath) . "/member/mail.php?dopost=checkmail&mid={$cfg_ml->fields['mid']}&userhash={$userhash}&do=1";
$url = eregi_replace('http://', '', $url);
$url = 'http://' . eregi_replace('//', '/', $url);
$mailtitle = "{$cfg_webname}--會員郵件驗證通知";
$mailbody = '';
$mailbody .= "尊敬的用戶[{$cfg_ml->fields['uname']}],您好:\r\n";
$mailbody .= "歡迎使用郵件訂閱功能。\r\n";
$mailbody .= "要通過驗證,請點擊或複製下麵鏈接到地址欄訪問這地址:\r\n\r\n";
$mailbody .= "{$url}\r\n\r\n";
if ($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) {
$mailtype = 'TXT';
require_once DEDEINC . '/mail.class.php';
$smtp = new smtp($cfg_smtp_server, $cfg_smtp_port, true, $cfg_smtp_usermail, $cfg_smtp_password);
$smtp->debug = false;
if (!$smtp->smtp_sockopen($cfg_smtp_server)) {
ShowMsg('郵件發送失敗,請聯係管理員', 'index.php');
exit;
}
$smtp->sendmail($cfg_ml->fields['email'], $cfg_webname, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
} else {
@mail($cfg_ml->fields['email'], $mailtitle, $mailbody);
}
if (empty($cfg_smtp_server)) {
ShowMsg('郵件發送失敗,請聯係管理員', 'index.php');
exit;
} else {
ShowMsg('成功發送郵件,請登錄你的郵箱進行接收!', 'index.php');
exit;
}
} else {