Swiftmailer がエラーを表示する理由がわかりません。
lib/classes/Swift/Transport/EsmtpTransport.php 内の未定義メソッド setPassword への致命的なエラー呼び出し
ファイルを確認しましたが、メソッドが含まれていません。私は正しいドキュメントに従っていますが、以下にあります。
http://swiftmailer.org/docs/sending.html#the-smtp-transport
私のコードはそのままです:
require_once 'lib/swift_required.php';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')->setUsername('myUserName@gmail.com')->setPassowrd('myPassword');
//$transport->setLocalDomain('[127.0.0.1]');
//The above has been tried with and with out.
$theMessage = Swift_Message::newInstance();
$to = 'toEmail@example.com';
$theMessage->setTo(array($to => 'aName');
$theMessage->setSubject = 'Contact Form';
$theMessage->setBody = $body;
$theMessage->setFrom(array($email => $name));
$theMessage->WordWrap = 50;
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($theMessage);