Home »
Joomla »
Joomla Код проверки отправки почты джумлой
Файл заливать в корень сайта/ Если в подпапке - надо подменять JPATH_BASE
initialise();
$e = 'text@example.ru';
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$mailer->setSender(array($config->getValue( 'config.mailfrom' ),$config->getValue( 'config.fromname' ))); // отправитель
// $mailer->setSender(array($e,$config->getValue( 'config.fromname' )));
$mailer->addRecipient(array($e)); // получатель
// $mailer->addRecipient(array($config->getValue( 'config.mailfrom' )));
$body = 'test
';
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setSubject('Testing sendmail');
$mailer->setBody($body);
$send =& $mailer->send();
if ( $send !== true ) {
echo 'Error sending email: ' . $send->get('message');
} else {
echo 'Mail sent';
}
Свежие комментарии