php - mail not getting sent on server -


i have 2 websites on hosted on 1 web site can send mail using php script using other web site cannot mail using php script. don't know going wrong. replaced php.ini file. there other thing left doing or something.

this code

$to="abc@gmail.com"; $subject="test mail"; $body="test mail"; $headers = "mime-version: 1.0" . "\r\n"; $headers .= "content-type:text/html;charset=iso-8859-1" . "\r\n";  $headers.='from: domain <def@gmail.com>' . "\r\n";   if(mail($to,$subject,$body,$header))  { echo "mailed"; } else { echo "not mailed"; } 

i tried directly embedding message mail function doesn't seems working.

this code after embedding message

if(mail("abc@gmail.com", "test subject", "test message", "from: def@gmail.com"))         {             echo "mailed";         }         else         {         echo "error:".mysql_error();         } 

i tried contacting hosting providers technical people. not find solution.

it's sample , works me:

        $to ='info@sample.com';         $message = '<a>hellow</a>';         $subject ='hello world'; $headers = "mime-version: 1.0" . "\r\n"; $headers .= "content-type:text/html;charset=utf-8" . "\r\n"; $headers .= "from: <sender@email.com>" . "\r\n"; $mail_sent=@mail($to,$subject,$message,$headers); echo $mail_sent ? "success" : "error"; 

if code not working , call server administrator check server...


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -