无法从查询字符串中获取电子邮件

时间:2013-05-25 14:06:47

标签: php email url

我无法从$_GET获取电子邮件地址。 这是我的代码:

<?php
    $eadd = $_GET['email'];
    echo("<p>Please check your inbox on your email $eadd.</p>");
?>

我去了这个链接:

http://localhost/file.php?email=myemail@company.com

然而输出只是:

Please check your inbox on your email .

修改

这是我的完整代码:

<?php
require_once "Mail.php";
//Get link posted info's needed

//Email
$eadd = $_GET['email'];

 $from = "OtakuJam Registration <no-reply@comp.com>";
 $to = " $unick < $eadd >";
 $subject = "Thank you for registering";
 $body = "Dear $unick ,
\n    Thank you for registering to OtakuJam. To activate your account, \n
    ";

 $host = "mail.srv.com";
 $username = "name@comp.com";
 $password = "mypass";

 $headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject);
 $smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
 'username' => $username,
 'password' => $password));

 $mail = $smtp->send($to, $headers, $body);

 if (PEAR::isError($mail)) {
   echo("<p>" . $mail->getMessage() . "</p>");
  } else {
   echo("<p>Please check your inbox on your email $eadd.</p>");
  }
?>

`请忽略那里的$ unick,除非我在代码上放了一封电子邮件而不是&lt; $ eadd&gt;

1 个答案:

答案 0 :(得分:0)

将我的$转换为$ to = $ unick。 &#34;&LT;&#34; 。 $ eadd。 &#34;&GT;&#34 ;; @Charlie给了我帮助我。还有那些告诉我使用&#34;。$ variable。&#34;。我的回声有帮助。感谢