Maison Martin Margiela Phpmail class send mail function code

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.