Jump to content

email - set reply to


flemingmike

Recommended Posts

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']}

Link to comment
https://forums.phpfreaks.com/topic/155678-email-set-reply-to/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819399
Share on other sites

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)

Link to comment
https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819401
Share on other sites

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. 

Link to comment
https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819403
Share on other sites

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. 

Link to comment
https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819404
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819407
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/155678-email-set-reply-to/#findComment-819409
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.