toker Posted January 8, 2008 Share Posted January 8, 2008 want to use a php script (works partially - sends a message to my inbox) but want it to work also to send a message to the sender. like, 'thank your for your email - we will reply usually within 2 days.' I am a dummy when it comes to this and been trying to see the catch but nothing works. anybody with some time to kill for a helping hand in this darkness? <? if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name'])) { $to = "[email protected]"; $subject = stripslashes($HTTP_POST_VARS['sender_subject']); $body = stripslashes($HTTP_POST_VARS['sender_message']); $body .= "\n\n---------------------------\n"; $body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n"; $header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n"; $header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n"; $header .= "X-Mailer: PHP/" . phpversion() . "\n"; $header .= "X-Priority: 1"; if(@mail($to, $subject, $body, $header)) { echo "output=sent"; } else { echo "output=error"; } } else { echo "output=error"; } ?> Link to comment https://forums.phpfreaks.com/topic/85000-solved-please-help-me-with-my-mail-php-going-nuts/ Share on other sites More sharing options...
priti Posted January 8, 2008 Share Posted January 8, 2008 If i have understood you correctly then you can think in this way also..... you can call mail() second time with $to changed with $from and $from with $to and change the $body content.create two function sendmailtoAdmin($to,$from) sendmailtoCosumer($to,$from) in both function define your $body accordingly and call both the funtions one after another. Regards Link to comment https://forums.phpfreaks.com/topic/85000-solved-please-help-me-with-my-mail-php-going-nuts/#findComment-433485 Share on other sites More sharing options...
toker Posted January 8, 2008 Author Share Posted January 8, 2008 I will play with it - thanx so far for the effort - great keep you posted toker Link to comment https://forums.phpfreaks.com/topic/85000-solved-please-help-me-with-my-mail-php-going-nuts/#findComment-433544 Share on other sites More sharing options...
toker Posted February 5, 2008 Author Share Posted February 5, 2008 Hi there I have played with it and got it working - thanx for your good advice. Toker Link to comment https://forums.phpfreaks.com/topic/85000-solved-please-help-me-with-my-mail-php-going-nuts/#findComment-458370 Share on other sites More sharing options...
priti Posted February 6, 2008 Share Posted February 6, 2008 welcome Link to comment https://forums.phpfreaks.com/topic/85000-solved-please-help-me-with-my-mail-php-going-nuts/#findComment-459477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.