How to pipe emails from Cpanel to Laravel 8?

39 Views Asked by At

Can you please help with piping incoming emails from Cpanel to laravel app?

So far I have made console controller emailparse (tested from console - makes log record to DB table). Now Cpanel - is on purchased web server. In Cpanel I am trying to add email forwarder ->setting up email I want to forward -> advanced options -> pipe to program . My path relative for project is

/home/profile/******.lv/estate

I tried different solutions:

/home/profile/******.lv/estate/artisan emailparse

When I try to add like this:

/usr/bin/php /home/profile/******.lv/estate/artisan emailparse

or:

/usr/bin/php -q /home/profile/******.lv/estate/artisan emailparse

or:

/usr/local/bin/php -q /home/profile/******.lv/estate/artisan emailparse

or:

/usr/local/bin/php /home/profile/******.lv/estate/artisan emailparse

saves as

/home/profile/******.lv/estate/artisan emailparse

and console controller is not triggered when mail comes in.

Any suggestions?

1

There are 1 best solutions below

0
Carlo Pokker On

So I found the problem and got more understanding how this works in cpanel

you must add path relative to your console command, in my case this would be

/home/profile/******.lv/estate/artisan emailparse

Next open artisan file in project root directory and at he top of the file write your webserver PHP interpreter path with parameter -q for executing and with a hash-bang (all in line 1)

#!/usr/local/bin/php -q
<?php

define('LARAVEL_START', microtime(true));