Jump to content

Send mail form .php


ghi572000

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("[email protected]", $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("[email protected]", $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("[email protected]", $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("[email protected]", $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

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.