After filling the form data and when hit submit button, need to send the form data to integerated Godaddy email. Im beginer for PHP. i have tried lot of method but not able to send email yousing static form.
Thankyou in advance
PHP Mailer Code
Customer Details
Customer request for contact
Name : $user_name
Phone No : $user_phone
Email : $user_email
Service Selected : $user_services
Comment : $user_msg
“;
$name = “Synatech Solution”; // Name of your website or yours
$to = “[email protected]”; // mail of reciever
$subject = $subject_msg;
$body = $my_body_data;
$from = “[email protected]”; // you mail
$password = “mypassword”; // your mail password
// Ignore from here
require_once “PHPMailer/PHPMailer.php”;
require_once “PHPMailer/SMTP.php”;
require_once “PHPMailer/Exception.php”;
$mail = new PHPMailer();
// To Here
//SMTP Settings
$mail->isSMTP();
// $mail->SMTPDebug = 3; Keep It commented this is used for debugging
$mail->Host = “smtpout.secureserver.net”; // smtp address of your email
$mail->SMTPAuth = true;
$mail->Username = $from;
$mail->Password = $password;
$mail->Port = 465; // port
$mail->SMTPSecure = “ssl”; // tls or ssl
$mail->SMTPOptions = array(
‘ssl’ => array(
‘verify_peer’ => false,
‘verify_peer_name’ => false,
‘allow_self_signed’ => true
)
);
//Email Settings
$mail->isHTML(true);
$mail->setFrom($from, $name);
$mail->addAddress($to); // enter email address whom you want to send
$mail->Subject = (“$subject”);
$mail->Body = $body;
if ($mail->send()) {
?>
<script>
alert('Mail Send Successfully');
window.location.href="index.php";
</script>
<?php
} else {
echo "Something is wrong: <br><br>" . $mail->ErrorInfo;
}
}
?>