Showing 1 – 1 of 1 replies
dhschang

I'm having issues with the contact form […]

dhschang PURCHASED
6 years ago
Hi,

I'm having issues with the contact form even after following your documentation. Been trying to troubleshoot this for days now and having to resort to this as last option. Can you please provide any suggestions on what I can try to fix this?

My url is https://korda.us.com/v1.html

My send_mail.php is as follows:
<?php
require '/PHPMailer/PHPMailerAutoload.php';
require '/PHPMailer/extras/Security.php';

define('SMTP_HOST', 'smtp.gmail.com'); // Hostname of the mail server
define('SMTP_USERNAME', 'dXXXXX@gmail.com'); // Username for SMTP authentication any valid email created in your domain
define('SMTP_PASSWORD', 'XXXXXX'); // Password for SMTP authentication
//define('SMTP_PORT', 465); // Port of the SMTP like to be 25, 80, 465 or 587

// To address who will receive this email
$to = 'dXXXXXX@gmail.com';

$security = new Security();

// This IF condition is for improving security and Prevent Direct Access to the Mail Script.
if (isset($_POST['name']) AND isset($_POST['email']) AND isset($_POST['subject']) AND isset($_POST['message']))
{

echo "my email $email";
// Collect POST data from form
$name = $security->xss_clean($_POST['name']);
$email = $security->xss_clean($_POST['email']);
// $subject = $security->xss_clean($_POST['subject']);
// $services = ($_POST['services'] <> '') ? implode(',', $security->xss_clean($_POST['services'])) : '-';
// $project_class = ($_POST['project_class'] <> '') ? $security->xss_clean($_POST['project_class']) : '-';
$message = $security->xss_clean($_POST['message']);

// Prefedined Variables
$set_from = 'KORDA Notification Mailer';
$subject = 'KORDA: Message from ' . $name . '!';

// Collecting all content in HTML Table
$content = '<table width="100%">
<tr><td colspan="2"><strong>Contact Details:</strong></td></tr>
<tr><td valign="top">Name:</td><td>' . $name . '</td></tr>
<tr><td valign="top">Email:</td><td>' . $email . '</td></tr>
<tr><td valign="top">Message:</td><td>' . $message . '</td></tr>
</table> ';

$mail = new PHPMailer;
$mail->isSMTP();
// $mail->SMTPDebug = 1;
// $mail->Debugoutput = 'html';
$mail->Host = SMTP_HOST;
$mail->Port = SMTP_PORT;
// $mail->SMTPSecure = 'tls';
// $mail->SMTPAutoTLS = false;
$mail->SMTPAuth = TRUE;
$mail->Username = SMTP_USERNAME;
$mail->Password = SMTP_PASSWORD;

$mail->setFrom(SMTP_USERNAME, $set_from);
$mail->addAddress($to);

$mail->Subject = $subject;
$mail->msgHTML($content);

// Send the message
$send = false;
if ($mail->send())
{
$send = true;
}

echo json_encode($send);
}
LuckyRoo
LuckyRoo SELLER
6 years ago
Hi,

Apologies for the late reply. Here's an example of sending an email using your gmail account: https://pastebin.com/9bpgMCWW

And you have to allowing less secure apps to access your account: https://myaccount.google.com/lesssecureapps?pli=1

Hope that helps :)

Thank you.
Al