I have a similar problem as this thread here mentioned: https://stackoverflow.com/questions/21009488/symfony2-delayed-flashbag-message-when-sending-mail and I want to see if anybody encountered this problem before with phalcon?
just for reference here is my model:
<?php
require_once __DIR__ . '/../../vendor/swiftmailer/swiftmailer/lib/swift_required.php';
use
\Phalcon\DI;
class NotificationsEmail extends BaseModel
{
public function initialize()
{
parent::initialize();
}
/**
* Function use to send notification email
*
* @param string $email
*/
public function sendConfirmationBooking($email, $teacherFirst, $studentFirst, $studentLast, $id){
// get data from config
$contacts = $this->getDI()->get('config')->get('contacts')->get('contact-us');
$gateway = $this->getDI()->get('config')->get('gmail-gateway');
$subject = "Confirmation of Booking for Lesson";
$name = 'confirmationBooking';
// Create transport using smtp credential
$transport = Swift_SmtpTransport::newInstance($gateway->host, $gateway->port, $gateway->security);
$transport->setUsername($gateway->username);
$transport->setPassword($gateway->password);
// Create the message
$message = Swift_Message::newInstance();
$message->setTo($email);
$message->setSubject($subject);
$message->setBody($this->getTemplateConfirmBooking($name, $teacherFirst, $studentFirst, $studentLast, $id),'text/html');
$message->setFrom($contacts->from, $contacts->name);
// Send the email
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);
return true;
}
No matter what I returned from this back to the controller the flash messages will not show up, but the flash message will show up if I comment out this function in my controller.