2016-11-10 74 views
0

有一些麻烦得到这个工作,所以我想我会问你的人。我只是试图让用户在输入字段中输入他们的电子邮件,然后向他们发送一封带有确认号码的电子邮件。电子邮件发送,但无法获得电子邮件中显示的确认号码。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" [email protected]'; 
    $result = 0; 

    passthru($cmd, $result); 

现在,我已经试过了与串联这样,但我也试着直列因为它只是呼应简单的语句,所以我试图用双引号,仍然一无所获内$ CONFIRMATION_CODE。正如人们在passthru文档中所建议的那样尝试了$ {confirmation_code}和{$ confirmation_code}。

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

回答

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" [email protected]';它应该可以工作。

+0

不幸的是它没有工作..电子邮件根本没有经过这个。 –

+0

有没有其他想法? –