本文整理汇总了PHP中smtp::mime_charset方法的典型用法代码示例。如果您正苦于以下问题:PHP smtp::mime_charset方法的具体用法?PHP smtp::mime_charset怎么用?PHP smtp::mime_charset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smtp
的用法示例。
在下文中一共展示了smtp::mime_charset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sent_mail
function sent_mail($to, $fromname, $fromemail, $subject, $body, $type = "confirmation", $showmsg = true, $multiple = false, $multiplemail = '', $hdr_encoding = 'UTF-8', $specialcase = '')
{
global $lang_functions;
global $rootpath, $SITENAME, $SITEEMAIL, $smtptype, $smtp, $smtp_host, $smtp_port, $smtp_from, $smtpaddress, $smtpport, $accountname, $accountpassword;
# Is the OS Windows or Mac or Linux?
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
$eol = "\r\n";
$windows = true;
} elseif (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) {
$eol = "\r";
} else {
$eol = "\n";
}
if ($smtptype == 'none') {
return false;
}
if ($smtptype == 'default') {
@mail($to, "=?" . $hdr_encoding . "?B?" . base64_encode($subject) . "?=", $body, "From: " . $SITEEMAIL . $eol . "Content-type: text/html; charset=" . $hdr_encoding . $eol, "-f{$SITEEMAIL}") or stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail']);
} elseif ($smtptype == 'advanced') {
$mid = md5(getip() . $fromname);
$name = $_SERVER["SERVER_NAME"];
$headers .= "From: {$fromname} <{$fromemail}>" . $eol;
$headers .= "Reply-To: {$fromname} <{$fromemail}>" . $eol;
$headers .= "Return-Path: {$fromname} <{$fromemail}>" . $eol;
$headers .= "Message-ID: <{$mid} thesystem@{$name}>" . $eol;
$headers .= "X-Mailer: PHP v" . phpversion() . $eol;
$headers .= "MIME-Version: 1.0" . $eol;
$headers .= "Content-type: text/html; charset=" . $hdr_encoding . $eol;
$headers .= "X-Sender: PHP" . $eol;
if ($multiple) {
$bcc_multiplemail = "";
foreach ($multiplemail as $toemail) {
$bcc_multiplemail = $bcc_multiplemail . ($bcc_multiplemail != "" ? "," : "") . $toemail;
}
$headers .= "Bcc: {$multiplemail}.{$eol}";
}
if ($smtp == "yes") {
ini_set('SMTP', $smtp_host);
ini_set('smtp_port', $smtp_port);
if ($windows) {
ini_set('sendmail_from', $smtp_from);
}
}
@mail($to, "=?" . $hdr_encoding . "?B?" . base64_encode($subject) . "?=", $body, $headers) or stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail']);
ini_restore(SMTP);
ini_restore(smtp_port);
if ($windows) {
ini_restore(sendmail_from);
}
} elseif ($smtptype == 'external') {
require_once $rootpath . 'include/smtp/smtp.lib.php';
$mail = new smtp($hdr_encoding, 'eYou');
$mail->debug(false);
$mail->open($smtpaddress, $smtpport);
$mail->auth($accountname, $accountpassword);
// $mail->bcc($multiplemail);
$mail->from($SITEEMAIL);
if ($multiple) {
$mail->multi_to_head($to);
foreach ($multiplemail as $toemail) {
$mail->multi_to($toemail);
}
} else {
$mail->to($to);
}
$mail->mime_content_transfer_encoding();
$mail->mime_charset('text/html', $hdr_encoding);
$mail->subject($subject);
$mail->body($body);
$mail->send() or stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail']);
$mail->close();
}
if ($showmsg) {
if ($type == "confirmation") {
stderr($lang_functions['std_success'], $lang_functions['std_confirmation_email_sent'] . "<b>" . htmlspecialchars($to) . "</b>.\n" . $lang_functions['std_please_wait'], false);
} elseif ($type == "details") {
stderr($lang_functions['std_success'], $lang_functions['std_account_details_sent'] . "<b>" . htmlspecialchars($to) . "</b>.\n" . $lang_functions['std_please_wait'], false);
}
} else {
return true;
}
}