0

我无法从 获取电子邮件地址$_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,除非我在代码上放一封电子邮件而不是 < $eadd >,否则邮件也不会发送

4

1 回答 1

0

将我的 $to 语法转换为 $to = $unick 。“<”。$eadd 。">"; 正如@Charlie 给我的那样帮助了我。还有那些告诉我使用“.$variable.”的人。对我的回声有帮助。谢谢

于 2013-05-25T14:42:21.413 回答