ユーザーの登録時にコンポーネントからメールを送信しようとしています。PHPMail、Sendmail、SMTP の 3 つすべてを試しましたが、どれも機能しません。localhost (WampServer 2.2) でテストしており、Joomla のバージョンは 2.5.4 です。これが WampServer の問題なのか、Joomla なのか、私自身のコードなのかはわかりません。これは私のコードです:
function postmail($name, $receiver){
jimport('joomla.mail.helper');
$mailer =& JFactory::getMailer();
$config =& JFactory::getConfig();
$sender = array($config->getValue( 'config.mailfrom'),$config->getValue( 'config.fromname' ) );
$mailer->setSender($sender);
$recipient = $receiver;
$mailer->addRecipient($recipient);
$body = "<body><br><p>";
$body .= "<strong>$name,</strong> ";
$body .= "</p><br></body>";
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setBody($body);
$send =& $mailer->Send();
if ( $send != true ) {
//echo 'Error sending email: ' . $send->message;
return false;
} else {
//echo 'Mail sent';
return true;
}
}
「メール機能をインスタンス化できませんでした」というエラーが発生します。