send mail

Discussion in 'PHP' started by dourvas, Nov 23, 2009.

  1. #1
    hallo there,

    i want to send mail. i get what i need from a form.
    the code to send the mail is
    
    else {
    	/*echo $email_address;
    	echo "<br>";
    	echo  $subject;
    	echo "<br>";
    	echo $message;
    	echo "<br>";
    	echo $headers;
    	echo "<br>";*/
    	if(mail($email_address, $subject, $message, $headers))
    	{	
    	//echo 9 never in here;
    	header("Location: ".$form_file."?msg=7");}
    	else
    	{
    	header("Location: ".$form_file."?msg=8");
    	}
    	
    	//echo 11;
    	}
    
    Code (markup):
    all the parametres of mail function is full with the right data. but the if condition is never true. it nevers sends the mail. Am i doing something wrong????
     
    dourvas, Nov 23, 2009 IP
  2. dourvas

    dourvas Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    someone??????

    is it possible that server side setting?. i should communicate with the web server administrator???
     
    dourvas, Nov 23, 2009 IP
  3. mob4u1

    mob4u1 Well-Known Member

    Messages:
    951
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #3
    can we see the $headers?

    maybe:
    $success = mail($email_address, $subject, $message, $headers);
    if (!$success){	
    //echo 9 never in here;
    header("Location: ".$form_file."?msg=8");
    } else {
    header("Location: ".$form_file."?msg=7");
    }
    
    Code (markup):
     
    mob4u1, Nov 25, 2009 IP
  4. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #4
    Try to email something to your email like this

    mail("youremail@domain.com","Test Email", "Test Message");

    instead of "youremail@domain.com" set your email :)
     
    s_ruben, Dec 1, 2009 IP
  5. mob4u1

    mob4u1 Well-Known Member

    Messages:
    951
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #5
    @s_ruben, the original poster is using variables in the form that is why he cannot just use
    mail("youremail@domain.com","Test Email", "Test Message");
    Code (markup):
     
    mob4u1, Dec 1, 2009 IP
  6. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #6
    mail("youremail@domain.com","Test Email", "Test Message");
    Code (markup):
    It is only for checking the server. Maybe the server doesn't send emails at all.
     
    s_ruben, Dec 1, 2009 IP
  7. mob4u1

    mob4u1 Well-Known Member

    Messages:
    951
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #7
    ah, i see your meaning now... :) good idea...
     
    mob4u1, Dec 1, 2009 IP