我使用SwiftMailer Libs时遇到此错误。
$message_body = "Body of message";
$transport = send_mail_transport();
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create the message
$message = Swift_Message::newInstance();
$message->setBody('$message_body'); //displays $message_body in mail client
$message->setBody($message_body); //throws parse error in browser
$message->setBody('Body of message'); //Works well. displays Body of message in mail client
//我打算从变量中获取值时会出现什么问题?
由于
答案 0 :(得分:0)
确定。弄清楚了 将其更改为
$message->setBody("$message_body");
有趣的是,他们的手册没有记录这一点。