简体   繁体   中英

PHP Send a mail to user mail address entered into a text box

I am trying to make a simple form that sends the user defined/entered email address a link to them.

Visitor > Enter Mail > Hit Send > Receives a mail with a link

But I am battling to make it work.

$headers = "From: Siddharth Jain <email>\\r\\n"; $headers .= "Reply-To: Siddharth Jain <email>\\r\\n"; $headers .= "Return-Path: email\\r\\n"; $headers .= "Bcc: Siddharth Jain <email>\\r\\n"; $headers .= "PHP/" . phpversion();

$to = $_REQUEST['email']; $subject=""; $mailcontent='Codeword: '.$_POST["text_box"];

$to = $_REQUEST['email']; $subject=""; $mailcontent='Codeword: '.$_POST["text_box"];

$to = $_REQUEST['email']; $subject=""; $mailcontent='Codeword: '.$_POST["text_box"];

mail($to, $subject, $mailcontent, $headers);

将“ email”替换为您的电子邮件,将“ Siddharth Jain”替换为您需要在该电子邮件中显示的名称。

thanks Mitali Mehta :)

Got this to work.

    <?php
// Contact subject
$subject ="mail subject"; 

// Details
$message="$detail";

// Mail of sender
$mail_from="no-reply@domain.com"; 

// From 
$header="from: no-reply@domain.com";

// Enter your email address
$to = $_REQUEST['customer_mail'];
$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
header("Location:http://www.domain.com/");
}
else {
echo "ERROR";
}
?>

in case someone else wants it :) also this sends me a copy of the request too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM