phalcon-ext / mailer Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
$params = array(
'subject' => 'Password Recovery',
'fullname' => 'Fullname'
);
$this->mailer->createMessageFromView('password_recovery', $params)->to($user[0]['email'], $userInfo->firstname.' '.$userInfo->lastname)->subject('Password Recovery')->send();
so I have temporay fix this issue by add "$view->setVar('params',$params);" before the line number 320 in file name Manager.php
in index.php
/**
* Setting up volt
*/
$di->set('volt', function($view, $di) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$volt->setOptions(array(
"compiledPath" => "../cache/volt/"
));
return $volt;
}, true);
/**
* Register the mail service which use Swift library
*/
$di->set('mail', function() {
$config = new Phalcon\Config\Adapter\Ini(__DIR__ . '/../app/config/mail.ini');
$mailer = new \Phalcon\Ext\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;
});
In Model:
public function beforeCreate() {
$mailer = $this->getDI()->getMail();
$viewPath = 'emailTemplates/newuser-' . $this->notifyLang . '';
$message = $mailer->createMessageFromView($viewPath, array('password' => $this->plainpass))
->to(array($this->email => $this->rname))
->subject('User Registration')
;
$message->send();
}
I Got The Error:
Phalcon\Mvc\View\Exception: View '/var/www/html/new/app/views/emailTemplates/newuser-bg' was not found in the views directory
File=/var/www/html/new/app/vendor/phalcon-ext/mailer/src/Manager.php
Line=312
#0 [internal function]: Phalcon\Mvc\View\Simple->_internalRender('emailTemplates/...', Array)
#1 /var/www/html/new/app/vendor/phalcon-ext/mailer/src/Manager.php(312): Phalcon\Mvc\View\Simple->render('emailTemplates/...', Array)
#2 /var/www/html/new/app/vendor/phalcon-ext/mailer/src/Manager.php(106): Phalcon\Ext\Mailer\Manager->renderView('emailTemplates/...', Array, '/var/www/html/n...')
#3 /var/www/html/new/app/models/Staff.php(37): Phalcon\Ext\Mailer\Manager->createMessageFromView('emailTemplates/...', Array, '/var/www/html/n...')
#4 [internal function]: Staff->beforeCreate()
#5 [internal function]: Phalcon\Mvc\Model->fireEventCancel('beforeCreate')
#6 [internal function]: Phalcon\Mvc\Model->_preSave(Object(Phalcon\Mvc\Model\MetaData\Memory), false, 'id')
#7 [internal function]: Phalcon\Mvc\Model->save()
#8 /var/www/html/new/app/controllers/StaffController.php(233): Phalcon\Mvc\Model->create()
#9 [internal function]: StaffController->createAction()
#10 [internal function]: Phalcon\Dispatcher->dispatch()
#11 /var/www/html/new/public/index.php(288): Phalcon\Mvc\Application->handle()
#12 {main}
I have checked many times that the view is there. when i do something like
nano /var/www/html/new/app/views/emailTemplates/newuser-bg.volt I have open the view in editor.
I can't understand why Phalcon\Mvc\View thinks that It is not there.
Could you help me with this issue.
Hi I would to know if It's will be a possibility to pass a Phalcon Config object in the construct.
thanks for the module though, really helpful
Not sure, but I think /src/Message.php createEmbedViaData() method is missing the $contentType parameter. At least, it didn't work for me until I added the following changes. I needed to embed contentType = text/calendar, but it wasn't working.
/**
* Create a Swift new Image.
*
* @param string $data
* @param string|null $name optional
* @param string|null $contentType optional
*
* @return \Swift_Image
*
* @see \Swift_Image::newInstance()
*/
protected function createEmbedViaData($data, $name = null, $contentType = null)
{
return $this->getManager()->getDI()->get('\Swift_Image', [$data, $name, $contentType]);
}
When attempting to auth using a Google Apps gmail account (custom domain), the connection is refused as it not "secure". Attempted both tls and ssl. No issues with standard gmail accounts. Research points to it requiring oauth.
There is a work around available, you can elect to make your account less secure in the settings, but other features may be disabled. Sometimes a reduction in security for a feature is not an option.
When using this package composer give me the warning:
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
The migration should be pretty simple: https://symfony.com/blog/the-end-of-swiftmailer
Migrating from Swiftmailer to Symfony Mailer is a relatively easy task as the concepts are the same between the two projects.
Are you interested in dropping swiftmailer
for symfony/mailer
?
Can I use the layout for the letter template?
Hi,
I am using this library with Phalcon 4.0 and above, but unfortunately the following error is thrown:
Class 'Phalcon\Mvc\User\Component' not found
This is easily fixable by changing the use of Phalcon\Mvc\User\Component to Phalcon\Di\Injectable
Hi,
maybe obvious, but I couldn't find information on this neither in the docs nor in the code:
Is it possible to send HTML formatted mails with a plain text alternative?
If so, could you tell me how?
Thanks in advance.
Hello, if I try to send an email with template, I receive the email with Subject, but without content(template is not loading).
If I try without template( createMessage() ), is working properly.
Path to template is good...is very wierd.
The change in master to 'Allow composers use Swiftmailer v6' has not been tagged to a version. This is requiring the use of dev-master in order to install the package.
This is causing an issue with my company's rules about usage of stable versions of third party packages as they are requiring SwiftMailer 6 for security reasons.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.