mail function doesn't work

the mail() function

Moderators: macek, egami, gesf

abdbad2015
New php-forum User
New php-forum User
Posts: 3
Joined: Sun Apr 27, 2014 7:49 am

mail function doesn't work

Postby abdbad2015 » Thu May 01, 2014 10:52 pm

Hi
Hi , I'm newbie in php.
my code is

Code: Select all

<?php
        // error reporting method will be discussed
        error_reporting(E_ALL&~E_NOTICE);
echo"welcome";
        if($_post['submit']){
            $title =$_post['title'];
            $name =$_post['name'];
            $mail=$_post['email'];
            $message =$_post['message'];
           
            $body = "you have the following from".$name."<br/>";
            $body .= "<p><b>".$title."</b></p>";
            $body .= "<p>".$message."</p>";
           
           
             //build emial
             $to = "abdallahbadarneh@yahoo.com" ;
             $header="From : ($name)<($email)";
             $subject="you have 1 feedback";
             $messge=$body;
             if(mail($to,$subject,$messge,$header)){
                 echo "thank you for yourfeedback";
             }else{
                 echo "unfortunatly , we have problem"; }
                 }
                 ?>

the problem is that it doesn't print the statement of [if] or the statement of [else] , why?

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 858
Joined: Mon Oct 01, 2012 12:32 pm

Re: mail function doesn't work

Postby seandisanti » Thu May 01, 2014 11:32 pm

you can use if ($_POST) to check if the post superglobal is instantiated, but to check an individual element, you should use isset($_POST['submit'])

User avatar
Haddep36
New php-forum User
New php-forum User
Posts: 6
Joined: Fri Jun 05, 2015 2:26 am
Location: US
Contact:

Fri May 02 2014 10 32 am

Postby Haddep36 » Fri Jun 12, 2015 1:10 am

I apologise, but it does not approach me. Who else, what can prompt?

fifatechno
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Sep 02, 2015 6:39 pm
Contact:

Re: mail function doesn't work

Postby fifatechno » Wed Sep 02, 2015 6:41 pm

sorry , I dont know


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron