本文整理汇总了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 {