Comments (9)
As stated in the documentation, you must first get the mailer, then create a message.
from symfony.
OK, thanks.
But why fatal error? And this strange messaage?
from symfony.
See also swiftmailer/swiftmailer#2
from symfony.
@umpersly This is because of the design of Swiftmailer. The initialization file has to be included before being able to use any classes of the library and SwiftmailerBundle includes it the first time you get the mailer service.
from symfony.
Thanks for the answers ;)
from symfony.
I don't get it!
$message = Swift_Message::newInstance(');
$message->setSubject('My subject');
Catchable fatal error: Argument 1 passed to Swift_Mime_SimpleMessage::__construct() must be an instance of Swift_Mime_HeaderSet
How to fix?
from symfony.
@rochapablo You must first call $this->get('mailer')
: It's a swiftmailer limitation.
from symfony.
@alexandresalome this limitation has been removed years ago thanks to the special autoloader registered by Swiftmailer (you should indeed avoid loading Swiftmailer classes with your own autoloader, but in composer-based projects, Swiftmailer handles it already)
from symfony.
I'm sorry, but I'm not understand yet, where came from the $this?
Because, where I'm calling the bellow code in my ClassController, and there's no get('mailer'). So it will not work.
$message = Swift_Message::newInstance();
$message->setSubject('My subject');
from symfony.
Related Issues (20)
- Missing translations for Hungarian (hu)
- Missing translations for Indonesian (id)
- Missing translations for Italian (it)
- Missing translations for Latvian (lv) HOT 1
- Missing translations for Lithuanian (lt)
- Missing translations for Polish (pl)
- Missing translations for Russian (ru)
- Missing translations for Spanish (es)
- Missing translations for Ukrainian (uk)
- Missing translations for Dutch (nl)
- [AssetMapper] Add minification since deprecated by cloudflare
- [DependencyInjection] Expected scalar, but got ParamConfigurator (or EnvConfigurator) HOT 2
- Symfony Serializer is omitting attributes when using groups HOT 2
- [Mailer] Command mailer:test seting fake 'From' header by default, gives misleading test results
- [Mime] Allow custom encoders for parts
- [Serializer] regression with attribute serialization
- [AssetMapper] Failed to download the file HOT 1
- [Serializer] `csv_headers` not working as expected HOT 1
- Simplify the definition of unique entity column names HOT 3
- [Validator] CharsetValidator throws TypeError when the value has an invalid charset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symfony.