Jump to content

Recommended Posts

I am trying to send the data entered in to the form to myself and to the user.

 

At the moment I am getting the data sent to myself but cant find the way to send it to the user.

 

I am using this code below

 

<?php

 

mail("webmaster@edgwaretown.co.uk", $subject, $message, $from);

 

?>

 

How can I get the user to get the data by email as well?

 

Thanks

Gary

Link to comment
https://forums.phpfreaks.com/topic/219108-send-mail-form-php/
Share on other sites

You'd just need to concatenate it to your $from variable, since that's the one that would hold additional headers for the mail() function. So to whatever that variable holds now you'd add a newline \n, then the Cc.

 


$sender = (sender's email address);
$from = "whatever it is now\n";
$from .= "Cc: $sender";
[/code]

Link to comment
https://forums.phpfreaks.com/topic/219108-send-mail-form-php/#findComment-1136229
Share on other sites

This is what I have now;

 

$message = " $todayis [EST] \n

Subject: $subject \n

From: $visitor \n

Email: $visitormail)\n

Phone: $phone \n

IP Address: IP = $ip \n

 

";

 

$from = "From: $visitormail\r\n";

 

 

mail("webmaster@edgwaretown.co.uk", $subject, $message, $from);

 

?>

 

Will this work or have I still got it wrong?

 

$message = " $todayis [EST] \n

Subject: $subject \n

From: $visitor \n

Email: $visitormail)\n

Phone: $phone \n

IP Address: IP = $ip \n

 

";

 

$from = "From: $visitormail\r\n";

$from .= "Cc: $visitormail\r\n";

 

 

mail("webmaster@town.co.uk", $subject, $message, $from);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/219108-send-mail-form-php/#findComment-1136233
Share on other sites

Okay thanks Pikachu2000 I have got it to work without the Cc in the mail code, however one more problem I need to solve is the Cc mail is being sent from my ISP servers address not mine? Do you know a way I can get the mail sent from my email address?

 

Thanks

Gary

:)

Link to comment
https://forums.phpfreaks.com/topic/219108-send-mail-form-php/#findComment-1136282
Share on other sites

yes I tried it but no luck?

 

should I add cc as followed?

 

$from = "From: $visitormail\r\n";

$from = "Cc: $visitormail\r\n";

 

mail("webmaster@edgwaretown.co.uk", $subject, $message, $from, $Cc);

 

 

 

You don't add $Cc in the mail() function, the Cc header is already in the $from variable . . .

Link to comment
https://forums.phpfreaks.com/topic/219108-send-mail-form-php/#findComment-1136286
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.