e-mail with Phpmailer How to click the button to send mail

Source: Internet
Author: User
e-mail with Phpmailer How to click the button to send a message
Now send an e-mail with Phpmailer, and the page refreshes and sends an email.
How to send an e-mail message by clicking a button on the page
------to solve the idea----------------------
You can do two pages.
For example, a refresh will send the page is sendmail.php, Button page is send.php

send.php















Then join in the sendmail.php.



------to solve the idea----------------------
Write a form, add a submit, send a message after submission.
------to solve the idea----------------------
or set the button directly to refresh mode
------to solve the idea----------------------
Now send an e-mail with Phpmailer, and the page refreshes and sends an email.



Reference:
reply 1 floor
So, what's that Phpmailer page supposed to say?



Header ("content-type:text/html; Charset=utf-8 ");
Require ("phpmailer/class.phpmailer.php"); Introducing Files
$mail = new Phpmailer (); Instantiation of
$mail->issmtp (); Enable SMTP
$mail->host= "smtp.126.com"; Name of the SMTP server
$mail->smtpauth = true; Enable SMTP authentication
$mail->username = "@126.com"; Your e-mail name
$mail->password = ""; Email password

$mail->from = "@126.com"; Sender address (i.e. your e-mail address)
$mail->fromname = ""; Sender's name
$mail->addaddress ("@126.com", "" "); Add recipients
$mail->addreplyto ("[Email protected]", "* * *"); Reply Address (can not fill in)

$mail->wordwrap = 50; Set character length per line
$mail->addattachment ("01.jpg", "manu.jpg"); Add an attachment and specify a name
$mail->ishtml (TRUE); Whether HTML-formatted messages

$mail->charset= "Utf-8"; Set up message encoding
$mail->subject = ""; Message subject
$mail->body = ""; Message content
$mail->altbody = "The body in plain text for non-html mail clients"; The message body does not support alternate display of HTML

if (! $mail->send ())
{
#echo "could not send mail.

";
#echo "Mailer Error:". $mail->errorinfo;
#exit ();
?>

} else {
echo "Mail has been sent";
?>

}
?>

  • Related Article

    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.