dsijovl015728613 2019-06-25 14:01
浏览 68

Swift Mailer错误登录lib / classes / Swift / Transport / EsmtpTransport.php [复制]

This question already has an answer here:

I have a new installation of Swift Mailer. When sending emails it fails and in the .errorlog file I have the following:

[25-Jun-2019 09:51:32 America/Detroit] PHP Parse error: syntax error, unexpected '?' in /home/qetbcdfu/public_html/swift/lib/classes/Swift/Transport/EsmtpTransport.php on line 213

Help appreciated!

require_once 'lib/swift_required.php';
// Create the Transport
$transport = (new Swift_SmtpTransport('mail.authsmtp.com', 25))
->setUsername('hidden')
->setPassword('hidden');
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$themessage .= "<p>Hi this is an email message that is a test message from Cedine's Swift AuthSMTP programming interface.  I hope you have enjoyed receiving this message.</p><p><strong>Please delete this message.</strong></p>"; 
$message = Swift_Message::newInstance('An Invitation to Join the Global CHE Network')
      ->setFrom('jim@jimnull.com')
      ->setTo(array('jsnull@outlook.com', 'jnull1955@gmail.com'))
      ->setBody($themessage, 'text/html');  
// Send the message
$result = $mailer->send($message);  
print "<p>Sent</p>";
</div>
  • 写回答

1条回答 默认 最新

  • dongqiaolong9034 2019-06-25 14:09
    关注

    I think you run on php 5.6 since the error is on a php 7.x operator.

    As we can see in the source code on line 213 they use ?? operator. This operator is available from php 7.x as is mentioned in the php docs

    Since php 5.6 is already end of life you should look into upgrading to a newer version of php

    评论

报告相同问题?

悬赏问题

  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python