Joomlaに基づいています!documentation @ http://docs.joomla.org/Sending_email_from_extensions、以下のコードでメールを送信しようとしています:
function sendmail($file,$mailto)
{
$mailer =& JFactory::getMailer();
//var_dump($mailer); exit;
$config =&JFactory::getConfig();
$sender = array(
$config->getValue( 'config.mailfrom' ),
$config->getValue( 'config.fromname' )
);
$mailer->setSender($sender);
$recipient = array($mailto);
$mailer->addRecipient($recipient);
$body = "Your body string\nin double quotes if you want to parse the \nnewlines etc";
$mailer->setSubject('Your subject string');
$mailer->setBody($body);
// Optional file attached
$mailer->addAttachment(JPATH_BASE.DS.'CSV'.DS.$file);
$send =&$mailer->Send();
if ( $send !== true ) {
echo 'Error sending email: ' . $send->message;
} else {
echo 'Mail sent';
}
}
($file
はファイル zip のフル パスで$mailto
、my gmail です。)
ただし、メールを送信すると、次のエラーが表示されます。
メール機能をインスタンス化できませんでした。
致命的なエラー: 行 142 の /var/www/html/dai/components/com_servicemanager/views/i0602/view.html.php の保護されたプロパティ JException::$message にアクセスできません
このエラーの原因は何ですか?