0

让这个工作有些麻烦,所以我想我会问你们。我只是想让用户简单地在输入字段中输入他们的电子邮件,然后向他们发送一封带有确认号的电子邮件。电子邮件发送,但无法获得在电子邮件中显示的确认号码。

     $cmd = 'echo "Please copy and paste the following link into your browser to confirm your registration: domain.subdomain.ca/user/confirm/"'.$confirmation_code.' | mail -s "Please confirm your login registration" foo@bar.com';
     $result = 0;

     passthru($cmd, $result);

现在我已经尝试过这种连接方式,但我也尝试过内联,因为它只是回显一个简单的语句,所以我尝试在双引号内使用 $confirmation_code ,仍然没有。还按照 passthru 文档中的建议尝试了 ${confirmation_code} 和 {$confirmation_code}。

电子邮件发送,一切正常,但我无法在电子邮件中显示确认码,所以如果有人有解决方案,将不胜感激!

4

1 回答 1

0

You are having problem with quotes in command string. Change it to: $cmd = 'echo "Please copy and paste the following link into your browser to confirm your registration: domain.subdomain.ca/user/confirm/'.$confirmation_code.'" | mail -s "Please confirm your login registration" foo@bar.com'; and it should work.

于 2016-11-10T06:39:15.880 回答