You can clone with
No one assigned
I want to use Swiftmail library and I've follow the doc trought out:
But I got:
Catchable fatal error: Argument 1 passed to Swift_Mime_SimpleMessage::__construct() must be an instance of Swift_Mime_HeaderSet, none given in /opt/lampp/lib/php/Swift/Mime/SimpleMessage.php on line 30
when I did:
$message = \Swift_Message::newInstance();
I got this error using swiftmailer from symfony2 project with this config:
mailer_transport = smtp
mailer_host = localhost
I've been snooping the new instance method and the constructor of Swift_Message and the error is raised because Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.message') return and empty array.
This is because you have not loaded the init file before using SwiftMailer
If you are using Symfony, take care to use the Swift autoloader in your autoload.php file (which load the file lazily) and not the Symfony autoloader to load Swift classes
@stof Thanks a lot, then in some place of the doc must be a reference to the init file.
Or in the Swift_Message::newInstance() check if the init file is loaded
@yoander The Swift doc talks about it in the chapter before the one you linked: http://swiftmailer.org/docs/including-the-files.html
And the Symfony doc does not mention it again but the standard distribution configures it properly.
Sorry, I misunderstood this chapter, I thought It was related with class loading and not with DI maybe because I'm not a native english speaker.