flemingmike Posted April 26, 2009 Share Posted April 26, 2009 hi all, im trying to set a reply to in my code, unsure how though. i currently have: $sendMessage=$inviter->sendMessage($_POST['oi_session_id'],$message,$selected_contacts); $inviter->logout(); $_SESSION["contactsarr"] = ""; if ($sendMessage===-1) { $message_footer="\r\n\r\n"; $message_subject=$message['subject']; $message_body=$message['body'].$message['attachment'].$message_footer; $headers="From: {$_POST['email_box']}"; foreach ($selected_contacts as $email=>$name) mail($email,$message_subject,$message_body,$headers); $oks['mails']="Mails sent successfully"; } any help on how to set reply to as {$_POST['email_box']} Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/ Share on other sites More sharing options...
nankoweap Posted April 26, 2009 Share Posted April 26, 2009 here's how i'm setting the from and reply-to: $headers = "From: " . $appInfo->getSystemEmail() . "\r\nReply-To: " . $appInfo->getSystemEmail(); $appInfo is a singleton that stores application level configuration data. jason Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819384 Share on other sites More sharing options...
flemingmike Posted April 26, 2009 Author Share Posted April 26, 2009 i want the reply to address to be the users email Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819386 Share on other sites More sharing options...
nankoweap Posted April 26, 2009 Share Posted April 26, 2009 so what's the problem? add Reply-To to the header and set it to whatever email address you want. i've given you the format of the header. it's just a matter of suiting it to your application's needs. jason Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819390 Share on other sites More sharing options...
mikesta707 Posted April 26, 2009 Share Posted April 26, 2009 $headers = "From: " . $_POST['email_box'] . "\r\nReply-To: " . $_POST['email_box']; Is this what you need? Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819391 Share on other sites More sharing options...
flemingmike Posted April 26, 2009 Author Share Posted April 26, 2009 its going to junk now, and still showing up as : FROM: [email protected] on behalf of [email protected] im hoping i can get it to show up as: FROM: 'EMAIL ADDRESS' Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819395 Share on other sites More sharing options...
mikesta707 Posted April 26, 2009 Share Posted April 26, 2009 hmm ok.. i still dont really get what you want, but It seems like you just want to set the From to that specific post variable. I thought you needed to set the Reply to header also, but I think I may see a problem. try changing $headers="From: {$_POST['email_box']}"; to $headers="From: ". $_POST['email_box']; I hope that helps. sorry if it doesnt Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819399 Share on other sites More sharing options...
nankoweap Posted April 26, 2009 Share Posted April 26, 2009 show us your modified code and the original text of the email sent which will include something like: To: [email protected] Subject: MT: Password Reset Request From: [email protected] Reply-To: [email protected] Message-Id: <[email protected]> Date: Sat, 25 Apr 2009 23:23:43 -0500 (CDT) Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819401 Share on other sites More sharing options...
flemingmike Posted April 26, 2009 Author Share Posted April 26, 2009 Email header looks right: Return-path: <[email protected]> Envelope-to: [email protected] Delivery-date: Sat, 25 Apr 2009 23:32:58 -0500 Received: from mash905 by carrera.mochahost.com with local (Exim 4.69) (envelope-from <[email protected]>) id 1Lxw30-00034D-Cg for [email protected]; Sat, 25 Apr 2009 23:32:58 -0500 To: [email protected] Subject: Video Games Online From: [email protected] Reply-To: [email protected] Message-Id: <[email protected]> Sender: <[email protected]> Date: Sat, 25 Apr 2009 23:32:58 -0500 php code: $sendMessage=$inviter->sendMessage($_POST['oi_session_id'],$message,$selected_contacts); $inviter->logout(); $_SESSION["contactsarr"] = ""; if ($sendMessage===-1) { $message_footer="\r\n\r\n"; $message_subject=$message['subject']; $message_body=$message['body'].$message['attachment'].$message_footer; $headers = "From: " . $_POST['email_box'] . "\r\nReply-To: " . $_POST['email_box']; foreach ($selected_contacts as $email=>$name) mail($email,$message_subject,$message_body,$headers); $oks['mails']="Mails sent successfully"; } Email Client (this is what im hoping to fix - The FROM field): Video Games Online From: [email protected] on behalf of [email protected] Sent: April 26, 2009 12:33:04 AM To: [email protected] Hey, thought you might want to check out http://www.vgbetting.com. Come play your PS3, XBox360, Wii, and PC games online. Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819403 Share on other sites More sharing options...
flemingmike Posted April 26, 2009 Author Share Posted April 26, 2009 oops... email client: Video Games Online From: [email protected] on behalf of [email protected] Sent: April 26, 2009 12:33:04 AM To: [email protected] Hey, thought you might want to check out http://www.vgbetting.com. Come play your PS3, XBox360, Wii, and PC games online. Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819404 Share on other sites More sharing options...
nankoweap Posted April 26, 2009 Share Posted April 26, 2009 interesting. at first i'd say it's an email client-ism, but at closer look i've never seen the Sender header. i'm wondering if you added Sender to the header and set its value just like the From and Reply-To if it would make it behave like you want. something like: $headers = "From: " . $_POST['email_box'] . "\r\nReply-To: " . $_POST['email_box'] . "\r\nSender: " . $_POST['email_box']; i'm not johnny-email so i don't know if this will work of fubar the whole thing, but what the hell. it's worth a try. Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819407 Share on other sites More sharing options...
flemingmike Posted April 26, 2009 Author Share Posted April 26, 2009 same thing: Return-path: <[email protected]> Envelope-to: [email protected] Delivery-date: Sat, 25 Apr 2009 23:45:06 -0500 Received: from mash905 by carrera.mochahost.com with local (Exim 4.69) (envelope-from <[email protected]>) id 1LxwEk-0006SS-6z for [email protected]; Sat, 25 Apr 2009 23:45:06 -0500 To: [email protected] Subject: Video Games Online From: [email protected] Reply-To: [email protected] Message-Id: <[email protected]> Sender: <[email protected]> Date: Sat, 25 Apr 2009 23:45:06 -0500 Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819409 Share on other sites More sharing options...
nankoweap Posted April 26, 2009 Share Posted April 26, 2009 Sender must not be a header that we have control over then. unless someone else has a bright idea, i think you're forked. jason Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819410 Share on other sites More sharing options...
nankoweap Posted April 26, 2009 Share Posted April 26, 2009 did some quick research and sender is not something we can control. it's added by the mail provider. how each client interprets and displays the message to the reader isn't under our control either. how are you sending email? do you have your own mail server or...? Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819415 Share on other sites More sharing options...
flemingmike Posted April 26, 2009 Author Share Posted April 26, 2009 its just sending through php on my web server (co-located) ill just have to live with it i guess Quote Link to comment https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819417 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.