With Phpmail This class, you don't have to worry about it. This is a foreigner wrote a class, we just "take doctrine". Here is a function that is written based on the Send () method inside the class:
Copy the Code code as follows:
function Send_mail ($title, $content, $from, $to, $charset = ' GBK ', $attachment = ')
{
Include '/class/phpmail.class.php ';
Header (' content-type:text/html; charset= '. $charset);
$mail = new Phpmailer ();
$mail->charset = $charset; Set to use gb2312 Chinese encoding
$mail->issmtp (); Set up SMTP to send mail
$mail->host = "smtp.qq.com"; Set the address of the mail server
$mail->port = 25; Set the port for the mail server, which defaults to 25
$mail->from = $from; Set the sender's e-mail address
$mail->fromname = ""; Set the sender's name
$mail->smtpauth = true; To set whether SMTP requires password authentication, true indicates that
$mail->username = $from; Set up a mailbox for sending mail
$mail->password = ""; Set the password for a mailbox
$mail->subject = $title; Set the title of a message
$mail->altbody = "text/html"; Optional, comment out and test
$mail->body = $content; Set up message content
$mail->ishtml (TRUE); Set whether the content is HTML type
$mail->wordwrap = 50; Set the number of characters per line
$mail->addreplyto ("Address", "name"); Set the address of the recipient to reply to
$mail->addaddress ($to, "star Model Training"); Set the address of the pickup
if ($attachment! = ")//Set Attachments
{
$mail->addattachment ($attachment, $attachment);
}
if (! $mail->send ())
{
return false;
} else {
return true;
}
}
is usually used QQ mailbox, because QQ mailbox is easy to open SMTP and POP3 services, and free, attention is the content format and encoding of the message.
PHPMail.class.php this class, click to download it!
The above describes the Maison Martin Margiela Phpmail class send mail function code, including the Maison Martin Margiela aspect of the content, I hope to be interested in PHP tutorial friends helpful.