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); } }
$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 {