0
因此,我试图为我的注册表单实现PHPMailer,但在处理验证电子邮件时出现错误。试图整合PHPMailer与我的登录/注册表格
它会将帐户添加到我的数据库中,但没有发送电子邮件。
我得到的错误:
注意:使用未定义的常量的PHPMailer的 - 假设 '的PHPMailer' 中/Applications/XAMPP/xamppfiles/htdocs/login/scripts/PHPMailer/PHPMailerAutoload.php第27行 的文件phpmailer.php无法找到。
中的代码PHPMailerAutoload.php
function PHPMailerAutoload($MailSender)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(phpmailer).DIRECTORY_SEPARATOR.'class.'.strtolower($MailSender).'.php';
if (is_readable($filename)) {
require $filename;
}
}
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
function __autoload($MailSender)
{
PHPMailerAutoload($MailSender);
}
}
这是我的文件结构:
修复!
代码应该是:
$filename = dirname(__FILE)__).DIRECTORY_SEPARATOR.'class.'.strtolower($MailSender).'.php';
这是正确的行,但它应该是文件名我很确定,因为它是__FILE__当我下载它。 –
@ J.Charnock尝试'dirname('phpmailer')' –
对不起,我过于复杂的东西,它应该被留作FILE。把它改回原来的样子,它就可以工作!嘿Presto –