PHP mail() seems not working

rhahao
edited November -1 in Bug/Issue Reports

Hi all,

I have made search through the forum but I am not able to see what should I do regarding my php script to send email to my gmail address.

Here is the php script:

$name = $_POST['user_name'];
$email = $_POST['email_address'];
$subject = $_POST['msg_subject'];
$body = $_POST['msg_body'];
$message = $body;
$to = "jwmeetingapps@gmail.com";
$subject = $subject;
If(!filter_var($email,FILTER_VALIDATE_EMAIL)){
echo "alert('Provide a valid email address!'); window.location.href='http://rhahao.ezyro.com/contact-us'; ";
} else {
If(mail ($to, $name . ":" . $subject, $message, "From: " . $email)){
echo "alert('Your message has been sent!'); window.location.href='http://rhahao.ezyro.com/contact-us'; ";
} else {
echo "alert('Unable to sent your message!'); window.location.href='http://rhahao.ezyro.com/contact-us'; ";
};
};

I received alert saying that message is sent by when looking at the gmail inbox, there is no message at all!
Here's the page I use to send the message: rhahao.ezyro.com/contact-us/
Thanks!

Comments

  • ChrisPAR
    edited November -1

    @rhahao said:
    Hi all,

    I have made search through the forum but I am not able to see what should I do regarding my php script to send email to my gmail address.

    Here is the php script:

    $name = $_POST['user_name'];
    $email = $_POST['email_address'];
    $subject = $_POST['msg_subject'];
    $body = $_POST['msg_body'];
    $message = $body;
    $to = "jwmeetingapps@gmail.com";
    $subject = $subject;
    If(!filter_var($email,FILTER_VALIDATE_EMAIL)){
    echo "alert('Provide a valid email address!'); window.location.href='http://rhahao.ezyro.com/contact-us'; ";
    } else {
    If(mail ($to, $name . ":" . $subject, $message, "From: " . $email)){
    echo "alert('Your message has been sent!'); window.location.href='http://rhahao.ezyro.com/contact-us'; ";
    } else {
    echo "alert('Unable to sent your message!'); window.location.href='http://rhahao.ezyro.com/contact-us'; ";
    };
    };

    I received alert saying that message is sent by when looking at the gmail inbox, there is no message at all!
    Here's the page I use to send the message: rhahao.ezyro.com/contact-us/
    Thanks!

    Please check this Support article. It is mentioned there that only specific types of emails are allowed to be we sent via PFH email system.

    You would need to configure an external service such as a free SMTP service to send emails from your website.

  • rhahao
    edited November -1

    Hi @ChrisPAR

    Sorry, I have overlooked the support article!
    This is helpful!

    Thank you!