2018-06-29 16:09
浏览 48

如何在Symfony 4中使用实例正确调用函数

I'm trying to send an email with SMTP in Symfony 4 and I have the following function as per the docs.

public function send_smtp(\Swift_Mailer $mailer)
    $message = (new \Swift_Message('Hello Email'))
        ->setBody('test email content');

However, I want to call this function from a different one like


But it complains about 'No parameters are passed' and


also gives the error message

Undefined constant 'Swift_Mailer'

What can be the problem and how could it be solved?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题