My website is not sending any email to my email address

Hi,

I try to create a website for wedding invitation.

Problem: My website is not sending any email to my email.

When my friends or family fill and send a simple form,
The website should send the form which is the guest name,email and either they will attending to the wedding or not to my email address.

Here’s my mail.php

    <?php
    if(!empty($_POST))
    {
     
    $name = 'Name: '.$_POST[name]."\n";
    $email = 'E-mail: '.$_POST[email]."\n";
    $guest = "Guest's Name: ".$_POST[guest]."\n";
    $attending = '#Attending: '.$_POST[attending]."\n";

     
    $ip = getRealIpAddr();
    $message = "$name$email$guest$attending\n\nFrom page: ".urldecode($_SERVER['HTTP_REFERER'])."\nIP: $ip\nBrowser: ".$_SERVER['HTTP_USER_AGENT']."\n";
    $error = array();

     
    if(empty($error))
    { 
    $mail =
    mail("[email protected]", "$title", $message,
     "From: [email protected]\r\n"
    ."Reply-To: [email protected]\r\n"
    ."Content-type:text/plain;charset=utf-8\r\n"
    ."X-Mailer: PHP/" . phpversion());

    }
    }
     
    function getRealIpAddr() {
            if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
                    $ip=$_SERVER['HTTP_CLIENT_IP'];
            } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                    $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
            } else {
                    $ip=$_SERVER['REMOTE_ADDR'];
            }
            return $ip;
    }
     
     ?>

You must use default PHP Mail function to use that form.
But that function is disabled for this free hosting:

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.