我正在使用Hostgator作为我的CPanel和域名。我使用html创建了一个网站,我在其中使用联系表单提交它转到一个php文件,它给我发了一封电子邮件。
它完美适用于亚马逊网络服务器,但我不知道将我的PHP文件放在hostgator cpanel中的哪个位置。我应该在某处安装php config并将其放在那里吗?
提前致谢。
Here is my php code
<?php
require 'PHPMailer/PHPMailerAutoload.php';
$name = $_POST['inputUsername'];
$email_address = $_POST['inputEmail'];
$message = $_POST['inputContent'];
$mail = new PHPMailer;
//$mail->SMTPDebug = 2;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'krishnakumar4315@gmail.com'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('something@gmail.com', 'Krishna');
$mail->addAddress('something@outlook.com', 'Krishna'); // Name is optional
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Message From: '.$name;
$mail->Body = $message ." <b>Email: </b>".$email_address;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
header('Location: http://www.krishdev.com');
}
?>