salman_ahad@yahoo.com Posted November 22, 2009 Share Posted November 22, 2009 I need to use the FROM address in mail function. I don't know what is the proper syntax. $to_email = "info@ideatoceo.com"; $from_email = "ansari@ideatoceo.com"; $subject = "Greetings"; $message = "Hi"; mail($to_email, $subject, $message); //proper syntax to use FROM address??? Quote Link to comment Share on other sites More sharing options...
Garethp Posted November 22, 2009 Share Posted November 22, 2009 $to_email = "info@ideatoceo.com"; $Headers = 'From: ansari@ideatoceo.com' . "\r\n" . 'Reply-To: ansari@ideatoceo.com'; $subject = "Greetings"; $message = "Hi"; mail($to_email, $subject, $message, $Headers); //proper syntax to use FROM address??? Next time, just check the documentation http://php.net/manual/en/function.mail.php Quote Link to comment Share on other sites More sharing options...
salman_ahad@yahoo.com Posted November 22, 2009 Author Share Posted November 22, 2009 I am already using Headers to attach my email template. I am still getting mail as From : Myname@xxxxx.12345.xxxx.server.net (I am still not getting From : ansari@ideatoceo.com) My code <?php $to_email = "mohammed.ahad@gmail.com"; $Headers = 'From: ansari@ideatoceo.com' . "\r\n" . $subject = "Greetings"; $message = '' . '<table width="676">' . '<tr>' . '<td width="30" height="52"><img src="http://www.ideatoceo.com/emails/Side.gif" width="30" height="50" alt="Corner" /></td>' . '<td width="600"><img src="http://www.ideatoceo.com/emails/Top.gif" width="600" height="50" alt="Top" /></td>' . '<td width="30"><img src="http://www.ideatoceo.com/emails/Side.gif" width="30" height="50" alt="Corner" /></td>' . '</tr>' . '<tr>' . '<td><img src="http://www.ideatoceo.com/emails/Side.gif" width="30" height="200" alt="Lside" /></td>' . '<td> <p>Asalam-alikum,</p>' . '<p>This EID get 30 calling minutes to Saudia Arabia FREE from <a href="http://www.rebtel.com/u/0131701413" target="_blank">Rebtel </a> , for New or Returning users. </p>' . '<p>Visit add credit and use the promotional code "Saudi30".</p>' . '<p><img src="http://www.ideatoceo.com/emails/Center.gif" alt="Center" width="600" height="8" align="absbottom" /></p>' . '<p>Awareness brought to you by <a href="http://www.ideatoceo.com/islam-emails.php" target="_blank">IdeatoCEO </a></p></td>' . '<td><img src="http://www.ideatoceo.com/emails/Side.gif" width="30" height="200" alt="Rside" /></td>' . '</tr>' . '<tr>' . '<td><img src="http://www.ideatoceo.com/emails/Side.gif" width="30" height="25" alt="Corner" /></td>' . '<td><img src="http://www.ideatoceo.com/emails/Bottom.gif" width="600" height="25" alt="Bottom" /></td>' . '<td><img src="http://www.ideatoceo.com/emails/Side.gif" width="30" height="25" alt="Corner" /></td>' . '</tr>' .'</table>' .'<table>' .'Forwarding Hadith to friends is now easy, visit <a href="http://www.ideatoceo.com/islam-emails.php" target="_blank">IdeatoCEO </a><br />' .'<a href="http://www.ideatoceo.com/islam/emails.php" target="_blank">Unsubscribe</a> from the distribution<br />' .' <br />' .'www.ideatoceo.com | 192 allen ave | Saint Louis | MO | 63104 <br />' .'</table>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to_email, $subject, $message, $headers); ?> Quote Link to comment Share on other sites More sharing options...
cags Posted November 22, 2009 Share Posted November 22, 2009 Variable names are case sensitive. Quote Link to comment Share on other sites More sharing options...
salman_ahad@yahoo.com Posted November 23, 2009 Author Share Posted November 23, 2009 I am still not getting the email From mentioned address. I am still getting from name@xxxxx.xxxx.xx.server.net (which is my hosting server) $headers = 'From: ansari@ideatoceo.com' . "\r\n" . What could be wrong now? Quote Link to comment Share on other sites More sharing options...
salman_ahad@yahoo.com Posted November 23, 2009 Author Share Posted November 23, 2009 Ok, fixed it...thanks guys Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.