maison martin margiela phpmail class send mail function code

WBOY
Release: 2016-07-29 08:48:03
Original
1273 people have browsed it

With the phpmail class, you don't have to worry. This is a class written by a foreigner, so we just "use it". The following is a function written based on the send() method in this class:

Copy code The code is 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 to use SMTP to send emails
$mail->Host = "smtp.qq .com"; //Set the address of the mail server
$mail->Port = 25; //Set the port of the mail server, the default is 25
$mail->From = $from; //Set the sender's port Email address
$mail->FromName = ""; //Set the sender's name
$mail->SMTPAuth = true; //Set whether SMTP requires password verification, true means it is required
$mail->Username = $from; //Set the email address for sending emails
$mail->Password = ""; //Set the password for the email address
$mail->Subject = $title; //Set the title of the email
$mail-> ;AltBody = "text/html"; // optional, comment out and test
$mail->Body = $content; //Set the email 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 reply recipient
$mail ->AddAddress($to,"Star Model Training"); //Set the recipient address
if ($attachment != '') //Set the attachment
{
$mail->AddAttachment($attachment, $attachment);
}
if(!$mail->Send())
{
return false;
} else {
return true;
}
}


Usually use QQ mailbox, because QQ mailbox It is easy to open SMTP and POP3 services, and it is free. What you need to pay attention to is the content format and encoding of the email.
PHPMail.class.php this class, click to download!

The above introduces the maison martin margiela phpmail class mail sending function code, including the content of maison martin margiela. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!