Jump to content

displaying email at bottom of confirmation email


sphinx

Recommended Posts

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 "donotreply@website.com" 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 = 'donotreply@website.com';

                //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.
donotreply@website.com

 

My objective is to remove the displayed email at the bottom of the message.

 

Many thanks

Link to comment
Share on other sites

You assign the value 'donotreply@website.com' 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]donotreply@website.com[/email]';

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.