尽管将 php.ini 配置为有效的 send_from 地址,我还是收到此错误。我知道它是有效的,因为当我从 squirrel mail 发送邮件时它可以工作,但是当我用 php 发送邮件时它就不起作用。无效地址大概是指 send_from 地址。所以我不明白它怎么会认为这是错误的。这是 php 代码:
$email="tobiasvogel1@googlemail.com";
$subject = "Your New Password";
$from="admin@dayshare.local";
$message = "Your new password is as follows:
xxxxxxxxxxxxxxxxxxxxxxxxxxx
This email was automatically generated.";
if(!mail($email, $subject,$message,$from)){
echo ("error");
}else echo "success";
Run Code Online (Sandbox Code Playgroud)
在 php.ini 中:
SMTP = localhost
sendmail_from = admin@dayshare.local
Run Code Online (Sandbox Code Playgroud) 所以我需要创建一个可变的子域来添加到域的末尾,但它不会识别变量.在这个例子中,它只会去google.com.有谁知道这样做的正确方法?
<html>
<?php $subdom="news";?>
<a href="http://www.google.com/"<?php echo $subdom;?>>google</a>
</html>
Run Code Online (Sandbox Code Playgroud)