[email protected] 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 = "[email protected]"; $from_email = "[email protected]"; $subject = "Greetings"; $message = "Hi"; mail($to_email, $subject, $message); //proper syntax to use FROM address??? Link to comment https://forums.phpfreaks.com/topic/182556-from-address-in-mail-function/ Share on other sites More sharing options...
Garethp Posted November 22, 2009 Share Posted November 22, 2009 $to_email = "[email protected]"; $Headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]'; $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 Link to comment https://forums.phpfreaks.com/topic/182556-from-address-in-mail-function/#findComment-963539 Share on other sites More sharing options...
[email protected] 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 : [email protected] (I am still not getting From : [email protected]) My code <?php $to_email = "[email protected]"; $Headers = 'From: [email protected]' . "\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); ?> Link to comment https://forums.phpfreaks.com/topic/182556-from-address-in-mail-function/#findComment-963548 Share on other sites More sharing options...
cags Posted November 22, 2009 Share Posted November 22, 2009 Variable names are case sensitive. Link to comment https://forums.phpfreaks.com/topic/182556-from-address-in-mail-function/#findComment-963551 Share on other sites More sharing options...
[email protected] 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 [email protected] (which is my hosting server) $headers = 'From: [email protected]' . "\r\n" . What could be wrong now? Link to comment https://forums.phpfreaks.com/topic/182556-from-address-in-mail-function/#findComment-963556 Share on other sites More sharing options...
[email protected] Posted November 23, 2009 Author Share Posted November 23, 2009 Ok, fixed it...thanks guys Link to comment https://forums.phpfreaks.com/topic/182556-from-address-in-mail-function/#findComment-963564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.