嗨我正在从页面获取值并在第二页获取值正常工作但我必须在url中发送值
<?php
session_start();
$_SESSION["email_address"] = $_REQUEST["email_address"];
echo "Favorite color is " . $_SESSION["email_address"] . ".<br>";
//$errors = '';
$myemail = 'info@abcdef.com';//<-----Put Your email address here.
$to_go="abcdef@gmail.com";
$to = $to_go;
$email_subject = "Contact form submission: aaname";
$email_body = "You have received a new message. ".
" Here are the details: Kindly <a href='localhost/ci/email_wait.php?email_address='.echo $email_address.'&password'=.$password.'>
Click Here</a> to reset your password";
$headers = "From:". $myemail;
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
echo "Mail Sent. Thank you we will contact you shortly.";
?>
注意:此代码不适用于localhost。
答案 0 :(得分:1)
你想要这样的东西:
$email = "something@somewhere.com";
$body = "Your email address is: $email, hooray!";
echo $body;
将输出Your email address is: something@somewhere.com, hooray!
答案 1 :(得分:0)
为什么要回复 $ email_address 以及初始化 email_address 的正确方法
$email_body = "You have received a new message. Here are the details: Kindly<a href='localhost/ci/email_wait.php?email_address='".$email_address."'&password='".$password."'>Click Here</a> to reset your password";
你也可以通过smtp设置从localhost发送邮件,并在邮件之前也放置标题
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";