我正在尝试在我的网站中实现验证码电子邮件,但是当我使用 mail() 函数时,它不会发送电子邮件。在四个参数(电子邮件、主题、消息、标题)中,我已将其缩小为导致问题的消息。
这是我的消息代码:
$EmailMessage = "You've almost finished your Website account registration! Just ensure the following is correct and then click the link below to complete the process. /r/nUsername: " . $User . "/r/nPassword: " . $Password . "/r/nEmail: " . $Email . "/r/nDate of Birth: " . $DOB . "/r/nMailing List: " . $MailListMail . "/r/nComplete Registration: http://www.ThisIsAWebsite.com/validate-account.php?User=" . $User . "&ValCode=" . $ValCode;
让我们说在这种情况下
$User = 'Username'
$Password = 'Password'
$Email = 'email@email.com'
$DOB = '1/1/1990'
$MailListMail = 'Yes'
$ValCode = 'abcd1234A1'
正在使用的功能是
mail($Email,'Account Creation',$EmailMessage, 'From:AccountCreation@email.com');
如果 $EmailMessage 设置为“Test”或类似的东西,则消息发送正常。
谁能看到我哪里出错了?