With the Phpmail class, you don't have to worry about it. This is a class written by a foreigner, we just "copycat". Here is a function written based on the Send () method inside the class:
Copy 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 up using gb2312 Chinese code
$mail->issmtp (); To set the SMTP way 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 by default of 25
$mail->from = $from; Set the sender's mailbox address
$mail->fromname = ""; Set the sender's name
$mail->smtpauth = true; To set whether SMTP requires password authentication, true indicates the need for
$mail->username = $from; Set up mailboxes to send messages
$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 content is HTML type
$mail->wordwrap = 50; Set the number of characters per line
$mail->addreplyto ("Address", "name"); Set the address of the recipient of the reply
$mail->addaddress ($to, "star Model Training"); Set the address of your inbox
if ($attachment!= ')//Set attachment
{
$mail->addattachment ($attachment, $attachment);
}
if (! $mail->send ())
{
return false;
} else {
return true;
}
}
Generally is using QQ mailbox, because QQ mailbox is easy to open SMTP and POP3 service, and free, attention is the content of the message format and coding.
PHPMail.class.php this class, click to download it!