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

    评论

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作