Phalcon CLI not sending email using Vokuro Code

Dear Members, I am using vokuro Mail plugin in my CLI code. The code sends emails whenever an order is created successfully in the database. Here is the afterCreate() code for sending emails.

<?php
$this->getDI()
             ->getMail()
             ->send($recipients, "Order Notification", 'orderstatus1', array(
             'cname' => $this->customers->name,
             'cemail' => $this->customers->email,
             'mobile' => $this->customers->mobile,
             'customerid' => $this->customers->customerid,
             'facility' => $this->membership->facilities->facilityname,
             'transactionstatus' => (!empty($this->transactionstatus)) ? $this->transactionstatus : "",
             'qid' => $this->customers->qid,
             'mid' => $this->membershipid,
             'dob' => $this->customers->dob,
             'nationality' => $this->customers->nationality,
             'startdate' => $this->membership->membershipdate,
             'enddate' => $this->membership->membershipexpirydate,
             'orderdate' => $this->orderdate,
             'membershiptype' => $this->membership->packages->packagedesc,
             'orderamount' => $this->membership->packages->packageamount,
             'facilityname' => $this->membership->facilities->facilityname,
             'paymentoption' => $this->membership->packages->paymentoption,
             'facilityimage' => $this->membership->facilities->facilityimage
        )
);

I have created a task for creating orders manually. But on successful creation of orders, I get the email text printed on my terminal but the email is never sent. Same works when its doen from website. I am using the flollowing command for the same.

/usr/bin/php-cli /home/xxx/public_html/xxxx/app/bootstrap_cli.php paymentprocessor

And then my terminal fills with email template that i have set but email does not send. Here is the sample output. https://ibb.co/QC7j8Mm

Any help will be appreciated.



5.6k

could be an issue with php cli using a different php.ini

did you check that afterCreate() actually gets excuted

could be an issue with php cli using a different php.ini

did you check that afterCreate() actually gets excuted

Yes, it does executes because my email template gets printed on my screen as shown in the screenshot.



5.6k

my bet is on php.ini

Try to wrap the code with try catch and see if there are any errors.

my bet is on php.ini

Sorry, I could not understand that. What should be I looking in 'php.ini'? Can you put me in the right direction?



5.6k

i would first go with @Jeckerson first

make sure all errors will show up error_reporting(E_ALL);

and wrap with try catch Throwable

if that didn't shed any light

you can check if there a difference with both php.inis anything would affect mail()

i would first go with @Jeckerson first

make sure all errors will show up error_reporting(E_ALL);

and wrap with try catch Throwable

if that didn't shed any light

you can check if there a difference with both php.inis anything would affect mail()

Some progress I made is as follows:

In mail plugin of vokuro, if i don't use $template = $this->getTemplate($name, $params); and instead use some static string as a message body , email gets delivered. This means that the issue is in getTemplate function and may be $view->setRenderLevel(View::LEVEL_LAYOUT); line specifically.

Any guidance?



5.6k

does $template = $this->getTemplate($name, $params); break the code or just rendering the view breaks the code ?

if your issue is rendering view you could just stop the render after calling $template = $this->getTemplate($name, $params);

$view->setRenderLevel(View::LEVEL_NO_RENDER);

edited Feb '20

does $template = $this->getTemplate($name, $params); break the code or just rendering the view breaks the code ?

if your issue is rendering view you could just kroger feedback stop the render after calling $template = $this->getTemplate($name, $params);

$view->setRenderLevel(View::LEVEL_NO_RENDER);

Thanks for leaving a comment.

edited Mar '20

does $template = $this->getTemplate($name, $params); break the code or just rendering the view breaks the code ?

if your issue is rendering view you could just stop the render after calling $template = $this->getTemplate($name, $params);

$view->setRenderLevel(View::LEVEL_NO_RENDER);

I have already tried this but even this is not doing the trick.

Should i create a separate view service for CLI module? May be, the shared view service is creating some issue?

I'm using this source code in my web page. You can try here to find the best way to integreat your source code.