Пытаюсь понять, как использовать SwiftMailer внутри Restler. Я думаю, что я могу просто включить это неправильно. Согласно документации SwiftMailer, все, что мне нужно сделать, это включить один файл через < strong>require_once, и их автозагрузчик делает всю магию, но я продолжаю получать ошибки Class not found. Предположительно Restler хорошо взаимодействует с другими автозагрузчиками.
Я пробовал следующий код в разных местах моих файлов рестлера (поместил require_once в index.php, а также внутри класса с остальной частью кода).
class Remind {
function post($request_data=NULL) {
[фрагмент]
require_once('../../Swift/lib/swift_required.php');
$transport = Swift_MailTransport::newInstance(); // Create the transport; use php mail
$mailer = Swift_Mailer::newInstance($transport); // Create the Mailer using your created Transport
$message = Swift_Message::newInstance() // Create the message
->setPriority($priority) // Give the message a priority, 1 through 5, 1 being the highest.
->setSubject($subject) // Give the message a subject
->setFrom(array($from_email => $from_name)) // Set the From address with an associative array
->setTo(array($to_email => $to_name)) // Set the To addresses with an associative array
->setReadReceiptTo(SYS_EMAIL) // Send read receipts to Support
->setBody('Here is the message itself') // Give it a body
->addPart('<q>Here is the message itself</q>', 'text/html') // And optionally an alternative body
;
$result = $mailer->send($message); // Send the message
}
}
Ошибка:
Fatal error: Class 'Swift_MailTransport' not found in /home/[snip]/public_html/[snip].php on line 63