Comments (4)
I try the next:
$di->set('mail', function() {
require_once DIR . '/../app/vendor/Swift/lib/swift_required.php';
$config = new Phalcon\Config\Adapter\Ini(DIR . '/../app/config/mail.ini');
$mailer = new Phalcon\Mailer\Manager(array(
"driver" => $config->mail->driver,
"host" => $config->mail->host,
"port" => $config->mail->port,
'encryption' => $config->mail->encryption,
'username' => $config->mail->username,
'password' => $config->mail->password,
'from' => array("email" => $config->mail->fromEmail, "name" => $config->mail->fromName)
));
return $mailer->createMessage();
});
When call
$this->getDI()->getMail()
->to(array($this->email => $this->rname))
->subject('User Registration')
->createMessageFromView('emailTemplates\newuser' , array('password' => 'asdasdas'));
I get error:
Fatal error: Class 'Phalcon\Mailer\Manager' not found in /var/www/html/new/public/index.php on line 214
I have the two files located at my app/plugins directory which is included in my loader, because i use other files from the same directory.
I try to include the files after requirement of Swift but i get another error.
from incubator.
@advokata
- replace "return $mailer->createMessage();" to "return $mailer"
- switfMailer version >= 5.2
- run composer install
- include /vendor/autoload.php
- PROFIT
createMessageFromView()
/**
* Global viewsDir for current instance Mailer\Manager.
*
* This parameter is OPTIONAL, If it is not specified,
* use DI from view service (getViewsDir)
*/
$config['viewsDir'] = __DIR__ . '/views/email/';
$mailer = new \Phalcon\Mailer\Manager($config);
// view relative to the folder viewsDir (REQUIRED)
$viewPath = 'email/example_message';
// Set variables to views (OPTIONAL)
$params [
'var1' => 'VAR VALUE 1',
'var2' => 'VAR VALUE 2',
...
'varN' => 'VAR VALUE N',
];
/**
* The local path to the folder viewsDir only this message. (OPTIONAL)
*
* This parameter is OPTIONAL, If it is not specified,
* use global parameter "viewsDir" from configuration.
*/
$viewsDirLocal = __DIR__ . '/views/email/local/';
$message = $mailer->createMessageFromView($viewPath, $params, $viewsDirLocal)
->to('[email protected]', 'OPTIONAL NAME')
->subject('Hello world!');
// Set the Cc addresses of this message.
$message->cc('[email protected]');
// Set the Bcc addresses of this message.
$message->bcc('[email protected]');
// Send message
$message->send();
from incubator.
@advokata this is solved?
from incubator.
I didn't try again. I have switched to Phalcon\Ext\Mailer which is the same but without this bug.
from incubator.
Related Issues (20)
- When i can use phalcon/incubator 4.0.5 in composer? HOT 2
- UnitTests helper with Phalcon 4.0 HOT 3
- Phalcon\Session\Adapter classes upgrade HOT 4
- Duplicate entry session id on high load
- Implement lazy write for session adapters
- Fix CI in Session component HOT 1
- Add support of incubator-events with phalcon 4.1
- Upgrade cache component
- ext-phalcon 4.0.5 composer install phalcon/incubator error. HOT 1
- DB Session adapter corupts session data with Postgresql DB
- Update Translate Adapters to v4
- Review Annotations component HOT 1
- Update CLI component to v4
- Update Db Adapters to v4
- Update `README.md` in mongoDB repository
- Uncaught Error: Class 'Phalcon\Mvc\Collection' not found HOT 1
- 'collectionManager' or 'collectionsManager' HOT 1
- Change out swiftmailer/swiftmailer for symphony/mailer HOT 4
- Traversing over mongdb results raise error because of missing \Countable implementation when using volt render engine. HOT 1
- incubator-mongodb implements Serializable which is deprecated in php8.1 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 incubator.