- This topic has 4 replies, 2 voices, and was last updated 5 years, 4 months ago by
Support. This post has been viewed 1203 times
-
AuthorPosts
-
February 27, 2021 at 7:03 am #10036496
umbrella
ParticipantHello,
My contact form is not working. Is not sending the message.
The page where you can find the page is
http://www.famileto.ro/2021/demo-cleaning-services-contact.htmlbelow the contact-form.php file:
<?php
/*
Name: Contact Form
Written by: Okler Themes – (http://www.okler.net)
Theme Version: 8.3.0
*/namespace PortoContactForm;
session_cache_limiter(‘nocache’);
header(‘Expires: ‘ . gmdate(‘r’, 0));header(‘Content-type: application/json’);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;require ‘php-mailer/src/PHPMailer.php’;
require ‘php-mailer/src/SMTP.php’;
require ‘php-mailer/src/Exception.php’;// Step 1 – Enter your email address below.
$email = ‘[email protected]’;// If the e-mail is not working, change the debug option to 2 | $debug = 2;
$debug = 0;// If contact form don’t has the subject input change the value of subject here
$subject = ( isset($_POST[‘subject’]) ) ? $_POST[‘subject’] : ‘Define subject in php/contact-form.php line 29’;$message = ”;
foreach($_POST as $label => $value) {
$label = ucwords($label);// Use the commented code below to change label texts. On this example will change “Email” to “Email Address”
// if( $label == ‘Email’ ) {
// $label = ‘Email Address’;
// }// Checkboxes
if( is_array($value) ) {
// Store new value
$value = implode(‘, ‘, $value);
}$message .= $label.”: ” . htmlspecialchars($value, ENT_QUOTES) . “<br>\n”;
}$mail = new PHPMailer(true);
try {
$mail->SMTPDebug = $debug; // Debug Mode
// Step 2 (Optional) – If you don’t receive the email, try to configure the parameters below:
//$mail->IsSMTP(); // Set mailer to use SMTP
//$mail->Host = ‘mail.famileto.ro’; // Specify main and backup server
//$mail->SMTPAuth = true; // Enable SMTP authentication
//$mail->Username = ‘[email protected]’; // SMTP username
//$mail->Password = ‘ddddddd’; // SMTP password
//$mail->SMTPSecure = ‘tls’; // Enable encryption, ‘ssl’ also accepted
//$mail->Port = 587; // TCP port to connect to$mail->AddAddress($email); // Add another recipient
//$mail->AddAddress(‘[email protected]’, ‘Person 2’); // Add a secondary recipient
//$mail->AddCC(‘[email protected]’, ‘Person 3’); // Add a “Cc” address.
//$mail->AddBCC(‘[email protected]’, ‘Person 4’); // Add a “Bcc” address.// From – Name
$fromName = ( isset($_POST[‘name’]) ) ? $_POST[‘name’] : ‘Website User’;
$mail->SetFrom($email, $fromName);// Repply To
if( isset($_POST[’email’]) ) {
$mail->AddReplyTo($_POST[’email’], $fromName);
}$mail->IsHTML(true); // Set email format to HTML
$mail->CharSet = ‘UTF-8’;
$mail->Subject = $subject;
$mail->Body = $message;$mail->Send();
$arrResult = array (‘response’=>’success’);} catch (Exception $e) {
$arrResult = array (‘response’=>’error’,’errorMessage’=>$e->errorMessage());
} catch (\Exception $e) {
$arrResult = array (‘response’=>’error’,’errorMessage’=>$e->getMessage());
}if ($debug == 0) {
echo json_encode($arrResult);
}
March 1, 2021 at 11:15 pm #10036515Support
KeymasterHello, first thanks for your purchase and sorry the delay for this reply.
The contact form file is returning error 500 in your server:
http://www.famileto.ro/2021/php/contact-form.phpError 500 can be caused by more than one reason. The most common are syntax error or PHP version.
– Check the PHP version: Make sure you have a minimum 5.6+ PHP version running in your server.
– Regarding syntax error we did not found any error in your contact form file.If even so the problem persist, please share with us the error_log file of your server (the .txt file where PHP errors are registered). This way we can know what’s the exactly error.
Please try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads
March 2, 2021 at 11:39 pm #10036568umbrella
ParticipantHello again,
I followed your advice and talked with the hosting company and they upgraded the php to 5.6. But the problem is still there. They told me:“You should check and verify the sending of messages is using SMTP authentication. So, we recommend to contact your programmer to use SMTP authentication with user and password with a email address on that domain.
The setting should be something like this:
Protocol: SMTP
Host: localhost:
Port: 25 or 587
Address: [email protected]
Password: your password
field FROM: should be identical with the address ([email protected])”So, I made the changes in the contact-form.php and introduce debug = 2 and changed the following block:
// Step 2 (Optional) – If you don’t receive the email, try to configure the parameters below:$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = ‘mail.famileto.ro’; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = ‘[email protected]’; // SMTP username
$mail->Password = ‘mypassword’; // SMTP password
$mail->SMTPSecure = ‘tls’; // Enable encryption, ‘ssl’ also accepted
$mail->Port = 587; // TCP port to connect toNow I get the following message:
Error! A aparut o eroare la trimiterea mesajului.
2021-03-01 14:53:44 SERVER -> CLIENT: 220-s66.rohost.com ESMTP Exim 4.93 #2 Mon, 01 Mar 2021 16:53:44 +0200 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2021-03-01 14:53:44 CLIENT -> SERVER: EHLO http://www.famileto.ro
2021-03-01 14:53:44 SERVER -> CLIENT: 250-s66.rohost.com Hello http://www.famileto.ro [46.102.145.144]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2021-03-01 14:53:44 CLIENT -> SERVER: STARTTLS
2021-03-01 14:53:44 SERVER -> CLIENT: 220 TLS go ahead
2021-03-01 14:53:44 CLIENT -> SERVER: EHLO http://www.famileto.ro
2021-03-01 14:53:44 SERVER -> CLIENT: 250-s66.rohost.com Hello http://www.famileto.ro [46.102.145.144]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250 HELP
2021-03-01 14:53:44 CLIENT -> SERVER: AUTH LOGIN
2021-03-01 14:53:44 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2021-03-01 14:53:44 CLIENT -> SERVER: [credentials hidden]
2021-03-01 14:53:44 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2021-03-01 14:53:44 CLIENT -> SERVER: [credentials hidden]
2021-03-01 14:53:44 SERVER -> CLIENT: 235 Authentication succeeded
2021-03-01 14:53:44 CLIENT -> SERVER: MAIL FROM:<[email protected]>
2021-03-01 14:53:44 SERVER -> CLIENT: 250 OK
2021-03-01 14:53:44 CLIENT -> SERVER: RCPT TO:<[email protected]>
2021-03-01 14:53:44 SERVER -> CLIENT: 250 Accepted
2021-03-01 14:53:44 CLIENT -> SERVER: DATA
2021-03-01 14:53:44 SERVER -> CLIENT: 354 Enter message, ending with “.” on a line by itself
2021-03-01 14:53:44 CLIENT -> SERVER: Date: Mon, 1 Mar 2021 14:53:44 +0000
2021-03-01 14:53:44 CLIENT -> SERVER: To: [email protected]
2021-03-01 14:53:44 CLIENT -> SERVER: From: asdf <[email protected]>
2021-03-01 14:53:44 CLIENT -> SERVER: Reply-To: asdf <[email protected]>
2021-03-01 14:53:44 CLIENT -> SERVER: Subject: asdfasd
2021-03-01 14:53:44 CLIENT -> SERVER: Message-ID: <[email protected]>
2021-03-01 14:53:44 CLIENT -> SERVER: X-Mailer: PHPMailer 6.1.4 (https://github.com/PHPMailer/PHPMailer)
2021-03-01 14:53:44 CLIENT -> SERVER: MIME-Version: 1.0
2021-03-01 14:53:44 CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8
2021-03-01 14:53:44 CLIENT -> SERVER:
2021-03-01 14:53:44 CLIENT -> SERVER: Name: asdf<br>
2021-03-01 14:53:44 CLIENT -> SERVER: Phone: asdfasdf<br>
2021-03-01 14:53:44 CLIENT -> SERVER: Email: [email protected]<br>
2021-03-01 14:53:44 CLIENT -> SERVER: Subject: asdfasd<br>
2021-03-01 14:53:44 CLIENT -> SERVER: Message: asdfasdf<br>
2021-03-01 14:53:44 CLIENT -> SERVER:
2021-03-01 14:53:44 CLIENT -> SERVER: .
2021-03-01 14:53:44 SERVER -> CLIENT: 250 OK id=1lGjvc-00ATe5-7v
2021-03-01 14:53:44 CLIENT -> SERVER: QUIT
2021-03-01 14:53:44 SERVER -> CLIENT: 221 s66.rohost.com closing connectionHow should I solve this issue?
Thanks
March 2, 2021 at 11:56 pm #10036569umbrella
ParticipantSo, the idea is I received the message by email, but on the website page instead of getting the message “Message sent successful”, it is displayed all the info mentioned in my previous message.
March 3, 2021 at 1:53 am #10036584Support
KeymasterHello,
You are receiving the message now, right ?
So you just need change the variable
$debugin the PHP file to$debug = 0;.Please try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads
-
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.