The previous mail (), has not been popular, so put on the most recent instances, leave to do memories.
Copy CodeThe code is as follows:
Require_once (DirName (__file__). " /.. /phpmailer/class.phpmailer.php ");
Contains class.phpmailer.php
/**
* @param string $send _to_mail target message
* @param stinrg $subject Theme
* @param string $body message content
* @param string $extra _hdrs additional information
* @param string $username recipient
* @param string $replyname reply person
* @param string $replymail reply to address
* @return Array (bealoon,string) returns a two element, Bealoon indicates success, string is the hint message
*/
function SendMail ($send _to_mail, $subject, $body, $extra _hdrs, $username, $replyname = "Reply", $replymail = " Reply@reply.com ") {
$mail =new Phpmailer ();
$mail->issmtp (); How to send mail
$mail->host= "smtp.host.com"; SMTP Server host Address
$mail->smtpauth=true; is a trustworthy SMTP
$mail->username= "reply@reply.com"; SMTP User name Note: Normal mail authentication does not need to add @ domain name
$mail->password= "******"; SMTP User Password
$mail->from= "send@send.com"; Sender e-mail address
$mail->fromname= "Send"; Sender
$mail->charset= "GB2312"; Specifying a character Set
$mail->encoding= "base64";
$mail->addaddress ($send _to_mail, $username); Add Send Destination Address
$mail->addreplyto ($replymail, $replyname); Add Reply to Address
$mail->ishtml (TRUE); Message type is in HTML format
$mail->subject= $subject; Message subject
Message content
$mail->body= "
". $body."
";
$mail->altbody= "text/html"; Content Text Format
if (@! $mail->send ()) {
$results =array ("Result" =>false, "message" = = $mail->errorinfo);
return $results;
}else{
$results = Array ("Result" =>true, "message" = = "message has been sent to {$send _to_mail}! ");
return $results;
}
}
$send _mail=sendmail ($to, $subject, $content, $headers, $name);
if ($send _mail["Result"]) {
echo $send _mail["message"];
}else{
echo $send _mail["message"];
}
Exit ();
?>
Copy CodeThe code is as follows:
Include (' class/class.phpmailer.php ');
$config = Array (
' Host ' = ' smtp.163.com ',
' Port ' = ' 25 ',
' User ' = ' * * * ',
' passwd ' = ' * * * *,
' From ' = ' juva_zz@163.com ',
' FromName ' = ' Zhengzhou ',
);
$subject = ' This is a test mail ';
$body = '
Test content |
This is the content |
';
$address = ' 379018082@qq.com ';
$username = ' I ';
$mail = new Phpmailer ();
$mail->charset = ' gb2312 ';
$mail->issmtp ();
$mail->host = $config [' Host '];
$mail->port = $config [' Port '];
$mail->from = $config [' from '];
$mail->fromname = $config [' FromName '];
$mail->smtpauth = true;
$mail->username = $config [' user '];
$mail->password = $config [' passwd '];
$mail->subject= $subject;
$mail->altbody= "text/html";
$mail->msghtml ($body);
$mail->addaddress ($address, $username);
if (! $mail->send ())
{
echo "Mail Error:". $mail->errorinfo;
}else
{
echo "Congratulations on the successful delivery!" ";
}
http://www.bkjia.com/PHPjc/326136.html www.bkjia.com true http://www.bkjia.com/PHPjc/326136.html techarticle the previous mail (), has not been popular, so put on the most recent instances, leave to do memories. Copy the code as follows: Php require_once (dirname (__file__). /.. /phpmailer/class.phpmailer ...