Send Message Error in PHP Wordpress

Welcome Everybody
Now i Have Problem in my php code In wordpress i had Created Page in PHP to Send Mail from this Page
After this When i Receive The E-mail From This Page i find The Mail Empty Without Any Information
Like This Photos
1.png 2.png


Staff member
Have you turned debugging on in your wp-config.php file? With debugging on, are there any frontend errors when submitting the form?

Try re-writing your code like this:

<?php get_header();

if (isset($_POST['submitted']) ) {
$to = "your email address";
$from = $_POST['message_name'];
$subject = $_POST['message_about'];
$message = $_POST['message_text'];
$phone = $_POST['message_phone'];
$email = $_POST['message_email'];
$country = $_POST['message_country'];
$payment = $_POST['message_payment'];
$headers = "from:" .$from;
$headers .= 'Reply-To:'. $email . "\r\n";
$headers .= "X-Mailer: PHP/" . phpversion(); // Sender's Email
$body = "From: $from\n E-Mail: $email\n Contact Number: $phone\n Country:\n $country Payment:\n $payment Message:\n $message";

if (isset($_POST['submitted'])) {
mail ($to, $subject, $body, $headers);

Always a good idea for the get_header(); to be the first declaration in the document.

Even better idea is to look into using SMTP rather than the php mail() declaration as it's a much more reliable method of delivering mail.
Last edited: