Php邮件函数给出“错误550:发件人是垃圾邮件发送者”;错误


Php mail function giving "Error 550:sender is spammer" error?

这是我的php代码:

            $to = $email;
            $subject = "Email Confirmation";
            $message="<h1>Welcome to asdasd.</h1>";
            $message .= "<br /><br /><br /><h4>This mail has been sent by asdasd.com to confirm your email account.</h4>";
            $message .= "<p>To confirm your email account and continue to the site click on the following link:</p>";
            $message .= "<a href='"http://localhost/asd"'"'">click here to continue</a>";
            $message .= "<br /><br /><p>If you have not signed up using this email or <br/>if you want to cancel your singup click here</p>";
            $header = "From:myrealemail@gmail.com 'r'n";
            $header .= "MIME-Version: 1.0'r'n";
            $header .= "Content-type: text/html'r'n";
            ini_set("sendmail_from", "abcd@gmail.com");
            $retval = mail ($to,$subject,$message,$header);

有什么问题吗?我正在使用这个服务器:smtp.bol.netin我可以用localhost代替吗?

删除

ini_set("sendmail_from", "abcd@gmail.com");

您是否在本地主机上运行此代码?邮件功能在本地主机上不工作。替换这一行。

$message .= "<a href='http://localhost/asd'>click here to continue</a>";