Comments (6)
Hi @mckrti it looks to me like maybe you don't have the default email delivery profile. In your config/app.php do you still have an email delivery profile called default?
It goes with this config value:
emailDeliveryProfile (string) - The email delivery profile (defined in config/app.php under the Email key) to use "default" is the default
If you don't have the default key you'll have to update your emailDeliveryProfile to whatever email delivery profile you want to use.
Let me know if this helps.
from cakephp-error-email.
Hi,
I do have the delivery profile in app.php
'EmailTransport' => [
'default' => [
'className' => 'Smtp',
//'className' => 'Mail',
// The following keys are used in SMTP transports
'host' => 'xxxx',
'port' => 111,
'timeout' => 30,
'username' => 'xxxxxx',
'password' => 'xxxxx',
'client' => null,
'tls' => true,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
],
/**
* Email delivery profiles
*
* Delivery profiles allow you to predefine various properties about email
* messages from your application and give the settings a name. This saves
* duplication across your application and makes maintenance and development
* easier. Each profile accepts a number of keys. See `Cake\Mailer\Email`
* for more information.
*/
'Email' => [
'default' => [
'transport' => 'default',
'from' => 'you@localhost',
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
],
],
from cakephp-error-email.
Hi @mckrti I didn't have time to look further into this last night, sorry, I'm hoping to have some time tonight to try to just install the plugin on a fresh version of cake 3.8.x. I would suggest you try the same as a next step if nothing obvious is popping out.
The reason I suggested you might not have a default config was following the stack trace you posted:
Fatal error: Uncaught InvalidArgumentException: Unknown email configuration "default". in /var/www/x/cakephp/vendor/cakephp/cakephp/src/Mailer/Email.php:2243
Stack trace:
#0 /var/www/x/cakephp/vendor/cakephp/cakephp/src/Mailer/Email.php(2083): Cake\Mailer\Email->_applyConfig(NULL)
#1 /var/www/x/cakephp/vendor/cakephp/cakephp/src/Mailer/Email.php(362): Cake\Mailer\Email->setProfile('default')
#2 /var/www/x/cakephp/vendor/ebrigham1/cakephp-error-email/src/Traits/EmailThrowableTrait.php(51): Cake\Mailer\Email->__construct('default')
#3 /var/www/x/cakephp/vendor/ebrigham1/cakephp-error-email/src/Traits/EmailThrowableTrait.php(37): ErrorEmail\Error\ErrorHandler->_getMailer()
#4 /var/www/x/cakephp/vendor/ebrigham1/cakephp-error-email/src/Error/ErrorHandler.php(80): ErrorEmail\Error\ErrorHandler->emailThrowable(Object(Error))
#5 /var/www/x/cakephp/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(176): ErrorEmail\Error\ErrorHandler->handleException( in /var/www/x/cakephp/vendor/cakephp/cakephp/src/Mailer/Email.php on line 2243
The relevant ones are
- #2 /var/www/x/cakephp/vendor/ebrigham1/cakephp-error-email/src/Traits/EmailThrowableTrait.php(51): Cake\Mailer\Email->__construct('default')
- #1 /var/www/x/cakephp/vendor/cakephp/cakephp/src/Mailer/Email.php(362): Cake\Mailer\Email->setProfile('default')
- #0 /var/www/x/cakephp/vendor/cakephp/cakephp/src/Mailer/Email.php(2083): Cake\Mailer\Email->_applyConfig(NULL)
- Fatal error: Uncaught InvalidArgumentException: Unknown email configuration "default". in /var/www/x/cakephp/vendor/cakephp/cakephp/src/Mailer/Email.php:2243
The two things I'm unsure about are 3 and 4. 3 Appears to say you're passing null in as the parameter for _applyConfig
which doesn't seem to make sense since in 4 you're passing the is_string
check and we see 'default'
being passed along through the rest of the stack trace. If you are passing the is_string
check with 'default'
then the only way to have that exception thrown would be if your config wasn't found from static::getConfig
. Is it possible your config isn't loaded yet at the time this error is happening?
from cakephp-error-email.
I checked and I do have these lines above in the Email.php file:
public function __construct($config = null)
{
$this->_appCharset = Configure::read('App.encoding');
if ($this->_appCharset !== null) {
$this->charset = $this->_appCharset;
}
$this->_domain = preg_replace('/\:\d+$/', '', env('HTTP_HOST'));
if (empty($this->_domain)) {
$this->_domain = php_uname('n');
}
$this->viewBuilder()
->setClassName('Cake\View\View')
->setTemplate('')
->setLayout('default')
->setHelpers(['Html']);
if ($config === null) {
$config = static::getConfig('default');
}
if ($config) {
$this->setProfile($config);
}
if (empty($this->headerCharset)) {
$this->headerCharset = $this->charset;
}
}
from cakephp-error-email.
Hi @mckrti
So I did some more testing and got a fresh install of cakephp 3.8.6. I installed the plugin and generated an error and everything seemed to work as expected. Have you been able to test with a fresh install yet? I still think your config isn't being loaded. Perhaps the error you're experiencing is happening before the app loads the config somewhere in the bootstrapping process? Can you find the original error that is triggering this error in the plugin code and fix see what it is? If its happening before config is loaded I believe the plugin will have trouble just because emailing depends being able to access config values.
from cakephp-error-email.
Hi @mckrti I haven't heard from you in a while, I'm going to guess this isn't still and issue but if it is please feel free to re-open this issue and we can discuss further.
from cakephp-error-email.
Related Issues (14)
- Async mails HOT 2
- Not notify Cake\Http\Exception\HttpException HOT 6
- Ignore premature headers emission HOT 4
- EmailThrowableTrait access to context / overriding default algorithms HOT 1
- Long error message causes "File name too long" issue
- CakePHP 4.x support
- Composer HOT 3
- Image for README
- sending emails on warnings and notice error also HOT 7
- Updating preview
- Not working HOT 5
- Replace deprecated 'here' attribute HOT 1
- Replace deprecated methods setTemplate() and setLayout() HOT 1
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 cakephp-error-email.