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";
?>
}
?>