Contact form using php script

Allison.mattivi
2 Posts
Allison.mattivi posted this 26 April 2022
Ask a Question

In my wordpress website, I created a contact form with "send email using PHP script," however it is not working and I am not getting emails. When someone submits it on the website, it says it was successful.

In my wordpress website, I created a contact form with "send email using PHP script," however it is not working and I am not getting emails. When someone submits it on the website, it says it was successful.
Vote to pay developers attention to this features or issue.
4 Replies
Order By: Standard | Newest
JhonAlbert
5 Posts
JhonAlbert posted this 26 April 2022

Try this code:

$name = isset($_POST['name']) ? $_POST['name'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$message = isset($_POST['message']) ? $_POST['message'] : '';   
$from = 'From: ContactForm'; 
$to = 'email@email.com'; 
$subject = 'Hello';
$verify = $_POST['verify'];

$body = "From: $name\n E-Mail: $email\n Message:\n $message";

if (isset($_POST["submit"]) && $verify == '4') {
    if (mail ($name, $email, $message)) { 
        echo '<p>Your message has been sent!</p>';
     } 

    else { 
        echo '<p>Something went wrong, go back and try again!</p>'; 
     }
  }    
    else if (isset($_POST["submit"]) && verify != '4') {
        echo '<p>You answered the anti-spam question incorrectly!</p>';
     }
Try this code: $name = isset($_POST['name']) ? $_POST['name'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; $message = isset($_POST['message']) ? $_POST['message'] : ''; $from = 'From: ContactForm'; $to = 'email@email.com'; $subject = 'Hello'; $verify = $_POST['verify']; $body = "From: $name\n E-Mail: $email\n Message:\n $message"; if (isset($_POST["submit"]) && $verify == '4') { if (mail ($name, $email, $message)) { echo '<p>Your message has been sent!</p>'; } else { echo '<p>Something went wrong, go back and try again!</p>'; } } else if (isset($_POST["submit"]) && verify != '4') { echo '<p>You answered the anti-spam question incorrectly!</p>'; }
Support Team
Support Team posted this 26 April 2022

Hello,

Thanks for contacting us

In WordPress you can set up and use the Contact Form 7 to receive emails from your visitors
https://nicepage.com/doc/66439/send-emails-with-contact-form-7-in-wordpress

Sending emails using PHP script mainly designed for HTML websites.
...................................................
Sincerely,
Ahmad M.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello, Thanks for contacting us In WordPress you can set up and use the Contact Form 7 to receive emails from your visitors https://nicepage.com/doc/66439/send-emails-with-contact-form-7-in-wordpress Sending emails using PHP script mainly designed for HTML websites. ................................................... Sincerely, Ahmad M. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
Allison.mattivi
2 Posts
Allison.mattivi posted this 26 April 2022

Thank you I got it to work with Contact Form 7!

Thank you I got it to work with Contact Form 7!
Support Team
Support Team posted this 26 April 2022

Hi,

That's great.
Feel free to contact us for further assistance
Also, check our documentation - https://nicepage.com/doc and read our Forum - https://nicepage.com/forum
Thank you.
...................................................
Sincerely,
Ahmad.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, That's great. Feel free to contact us for further assistance Also, check our documentation - https://nicepage.com/doc and read our Forum - https://nicepage.com/forum Thank you. ................................................... Sincerely, Ahmad. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
You must log in or register to leave comments