php code to send email from contact form – The simplest way to send an email with PHP is to send a text email. PHP script to connect to a SMTP server and send email.
php code to send email from contact form
Simple HTML PHP Source Codes For Create a PHP Send Email Contact Form Example. Send email with PHP from html form on submit with the same script
today i am going to learn how to connect the Contact form with PHP mail for your website.
Step : 1 Simple HTML Contact Form to send Email in PHP
Create a simple contact form with PHP and send email.
index.php
php code to send email from contact form - www.pakainfo.com
Don’t Miss : Simple file attachment in PHP mail function
Step 2: Sending the Email with PHP
In emails, settings headers are really important.
liveMailSnd.php
isSMTP(); $smail->Host = "smtp.gmail.com"; $smail->SMTPAuth = true; $smail->Username = "pakainfo@gmail.com"; $smail->Password = 'yourpassword'; $smail->Port = 465; $smail->SMTPSecure = "ssl"; //here some email settings $smail->isHTML(true); $smail->setFrom($email, $name); $smail->addAddress("pakainfo@gmail.com"); $smail->Subject = ("$email ($title)"); $smail->Body = $message; if($smail->send()){ $status = "success"; $response = "Good Luck, Great Your Email is sent!"; } else { $status = "failed"; $response = "Sorry, Something is wrong:
" . $mail->ErrorInfo; } exit(json_encode(array("status" => $status, "response" => $response))); } ?>
I hope you get an idea about php code to send email from contact form.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.