samoi Posted December 17, 2008 Share Posted December 17, 2008 hello guys ! if (isset($_POST['submit'])) { $subject = $_POST['subject']; $message = $_POST['message']; $users = "SELECT email FROM gb"; $result = mysql_query($users) or die(mysql_error()); while ($me = mysql_fetch_assoc($result)) { if (mail($me['email'], $subject, $message)) { echo $me['user']; echo "-----"; echo $me['email']; echo "---- Has been contacted<br />"; } else { echo "Failed"; } } } I need it to work as follow: when I send the email FOR EXAMPLE to ME, I receive a long email address, actually it's the server's default email address any help ? Link to comment https://forums.phpfreaks.com/topic/137307-mail-i-want-it-to-send-a-specific-sender-email-and-not-the-servers-email/ Share on other sites More sharing options...
xtopolis Posted December 17, 2008 Share Posted December 17, 2008 Set the appropriate headers: Found on the manual site, example 2 <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Link to comment https://forums.phpfreaks.com/topic/137307-mail-i-want-it-to-send-a-specific-sender-email-and-not-the-servers-email/#findComment-717415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.