私の現在のコードはこれです
$swift = email::connect();
$swift->setSubject('hello')
->setFrom(array('alex@example.com.au' => 'Alex'))
->setTo(array('alex@example.com.au' => 'Alex'))
->setBody('hello')
->attach(Swift_Attachment::fromPath(DOCROOT . 'assets/attachments/instructions.pdf'));
$swift->send();
email::connect()
は SwiftMailer のインスタンスを返します。
これらのドキュメントに従って、動作するはずです。
ただし、エラーが発生します
Fatal error: Call to undefined method Swift_Mailer::setSubject() in /home/user/public_html/application/classes/controller/properties.php on line 45
email::connect()
ドキュメントのサンプルコードとまったく同じことをするのを見てきました。あれは
- 正しいファイルを含める
- ライブラリのインスタンスを返す
私は何を間違っていますか?
ありがとう