Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I'm new to php.

how to send email in php. i have tried some code which is available on websites, but i'm not getting any email.

please help me guys.

Thanks

What I have tried:

$to = "abdulsubhan.it@gmail.com";
$subject = "Sent mail from php";


$message = "This is HTML message.";
$message .= "

This is headline.

";

$header = "From:abc@somedomain.com \r\n";
$header = "Cc:subhani.029@gmail.com \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";

$retval = mail ($to,$subject,$message,$header);

if( $retval == true ) {
echo "Message sent successfully...";
}else {
echo "Message could not be sent...Error Encountered!";
}
?>

Success message is coming but not email.

i'm little bit confused.
this php code is not having any smtp variables, from email-password, nothing...
Directly will send this email?
Posted
Updated 7-Feb-16 20:31pm
v2

1 solution

 
Share this answer
 
Comments
abdul subhan mohammed 8-Feb-16 6:09am    
Dear,
i have already gone with these stuff n i tried too.
but still i didn't get, that's why i posted a question here.
Thanks
Richard MacCutchan 8-Feb-16 9:13am    
What smtp server do you have configured?
abdul subhan mohammed 10-Feb-16 1:57am    
gmail n my company domain(rak.sa.com)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900