sphinx Posted September 21, 2011 Share Posted September 21, 2011 Hello, When a user sends a message using my contact form, they will get a confirmation to the supplied email to confirm that the email has been recieved, one problem is, the auto-reply message displays "[email protected]" at the bottom of it, here is some of my code: //AUTO-REPLY CLIENT CODE START $confirmation = $visitor_email; $consubject="Your message has been recieved"; $body2 = "Hello $name, \nThe below message has now been recieved.\n\n >> $user_message <<\n\nWe will reply to you shortly.\n\nThank you,\n\nThe website Team.\n\n\nThis is an automated message, please do not reply to it.\n". $fromnoreply = '[email protected]'; //AUTO-REPLY CLIENT CODE END //TO WEBMAIL CODE START $to = $your_email; $subject="Contact form - $name"; $from = $visitor_email; $from = $your_email; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $body = "A user $name submitted the contact form:\n". "Name: $name\n". "Email: $visitor_email \n". "Message: \n ". "$user_message\n". "IP: $ip\n"; //TO WEBMAIL CODE END //headers $headers = "From: $from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; $headers2 = "From: $fromnoreply \r\n"; $headers2 .= ""; // the important stuff!, yes definately! JAMES mail($to, $subject, $body,$headers); mail($confirmation, $consubject, $body2,$headers2); header('Location: ?sent'); //where shall i go once message is sent?? Possibly here. *wink* The above code automatically sends the below email to the client aswell as sending the clients message to me. Hello Bob Smith, The below message has now been recieved. >> This is a test << We will reply to you shortly. Thank you, The website Team. This is an automated message, please do not reply to it. [email protected] My objective is to remove the displayed email at the bottom of the message. Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/247594-displaying-email-at-bottom-of-confirmation-email/ Share on other sites More sharing options...
StormTheGates Posted September 21, 2011 Share Posted September 21, 2011 What device are you looking at this email from? Sometimes handhelds like phones append that stuff to the end. Other than that do you control the server or is it hosted through someone else? And do you control the email its being sent from? Quote Link to comment https://forums.phpfreaks.com/topic/247594-displaying-email-at-bottom-of-confirmation-email/#findComment-1271430 Share on other sites More sharing options...
sphinx Posted September 21, 2011 Author Share Posted September 21, 2011 No I don't control the email server and i'm looking at it through out look. Is this likely to be server related? I couldn't see the problem from the code either. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/247594-displaying-email-at-bottom-of-confirmation-email/#findComment-1271431 Share on other sites More sharing options...
Pikachu2000 Posted September 21, 2011 Share Posted September 21, 2011 You assign the value '[email protected]' to the $fromnoreply variable and because you've got a concatenation operator instead of a line termination at the end of the previous string, you also inadvertently concatenate it to $body2 at the same time. That's why it's showing up where it is. This is how those two lines effectively read, do you see the problem there? $body2 = "Hello $name, \nThe below message has now been recieved.\n\n >> $user_message <<\n\nWe will reply to you shortly.\n\nThank you,\n\nThe website Team.\n\n\nThis is an automated message, please do not reply to it.\n". $fromnoreply = '[email][email protected][/email]'; Quote Link to comment https://forums.phpfreaks.com/topic/247594-displaying-email-at-bottom-of-confirmation-email/#findComment-1271456 Share on other sites More sharing options...
sphinx Posted September 21, 2011 Author Share Posted September 21, 2011 superb, thanks, ended it with: please do not reply to it.\n"; Worked perfectly, thanks Quote Link to comment https://forums.phpfreaks.com/topic/247594-displaying-email-at-bottom-of-confirmation-email/#findComment-1271478 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.