i dont recieve any mail in my box, can someone help and tell me whats the problem!!

Recommended Answers

Output PHP errors and post them here please or get them from your error.log file. If you're local it's php_error_log

Jump to Post

Is test.powerm.ma a valid email address?

Jump to Post

well, umm, no, it isnt,

e-mail address #
Any string that matches the following [ABNF] production:
1( atext / "." ) "@" ldh-str 1( "." ldh-str )…where atext is as defined in …

Jump to Post

All 12 Replies

<?php
    if (empty($_POST) === false) {
        $errors = array();

        $name       = $_POST['name'];
        $email      = $_POST['email'];
        $message    = $_POST['message'];

        if (empty($name) === true || empty($email) === true || empty($message) === true) {
            $errors[] = 'Name, email and message are required';
        }else{
            if (filter_var($email,FILTER_VALIDATE_EMAIL) === false) {
                $errors[] = 'That\'s not a valid email';
            }

            if (ctype_alpha($name) === false) {
                $errors[] = 'Name must only contain letters';
            }
        }

        if (empty($errors) === true){
            mail('test.powerm.ma', 'Contact form', $message, 'From: ' . $email);
            header('Location: index.php?sent');
            exit();
        }
    }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>

    <?php 
        if (empty($errors) === false) {
            echo '<ul>';
            foreach($errors as $errors) {
                echo '<li>', $errors, '</li>';
            }
            echo '</ul>';
        }
    ?>
    <form action="" method="post">
        <p>
            <label for="name">Name:</label><br>
            <input type="text" name="name" id="name" <?php if(isset($_POST['name']) === true) {echo 'value=', strip_tags($_POST['name']), '"'; }?>>
        </p>

        <p>
            <label for="email">Email:</label><br>
            <input type="text" name="email" id="email" <?php if(isset($_POST['email']) === true) {echo 'value=', strip_tags($_POST['email']), '"'; }?>>
        </p>

        <p>
            <label for="message">Message:</label><br>
            <textarea name="message" id="message"><?php if(isset($_POST['message']) === true) {echo  strip_tags($_POST['message']); }?></textarea>
        </p>

        <p>          
            <input type="submit" value="Submit" />
        </p>
    </form>
</body>
</html>

Output PHP errors and post them here please or get them from your error.log file. If you're local it's php_error_log

there are no errors but when i check my box i dont find the email

Member Avatar

Is test.powerm.ma a valid email address?

yes it's a valid email

@yachile,

Really???

I have never in 15 years seen an email address that looks like this!!!

it's just to test my contact form, but it's a valid mail

well, umm, no, it isnt,

e-mail address #
Any string that matches the following [ABNF] production:
1( atext / "." ) "@" ldh-str 1( "." ldh-str )…where atext is as defined in [RFC 5322], and ldh-str is as defined in [RFC 1034].

Examples:

foo-bar.baz@example.com

must contain @

the same problem even i use test@powerm.ma

Member Avatar

I copied your code and just changed the email address to mine. I got the email fine.
Have you tried checking your spam or junk folder?

done it works, thx

Was that the problem... it hit your spam/junk...??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.