包含变量的Mailx passthru()

时间:2016-11-10 03:08:55

标签: php laravel mailx passthru

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

     $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}。

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

1 个答案:

答案 0 :(得分: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';它应该有用。