Pipe emails into cakePHP

Hi,

Im looking at piping incoming emails into cakePHP

I have tried setting up a Console command to make it work but i cant seem to make it work.

Any help to get this working would be greatly appreciated.

It generally works better if you share specifically what you’ve tried (e.g. code). Otherwise, you’re not really asking for help fixing what you have, you’re asking people to do all the work for you.

you mean to setup an emails server that calls a command for each incoming email?

something like

cat temp_mail.msg | /app/bin/cake parse_mail

if that so, you can parse the console input with hfig/MAPI

However, i would create a command that reads an IMAP box periodically, with ddeboer/imap, i would work with external mails providers.

Code is here Mtbrandall's Pastebin - Pastebin.com

When i rung from the SSH terminal it works fine but whenever i send via email the emails get bounced with an error
This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

pipe to |/home/cobaltholidays/[#######/public_html/bin/cake.php](http://########public_html/bin/cake.php) ticket
generated by [debug@cobaltholidays.co.uk](mailto:debug@cobaltholidays.co.uk)
local delivery failed

The following text was generated during the delivery attempt:

------ pipe to |/home/cobaltholidays/[pontus.cobaltholidays.co.uk/public_html/bin/cake.php](http://#######/public_html/bin/cake.php) ticket
generated by [debug@cobaltholidays.co.uk](mailto:debug@cobaltholidays.co.uk) ------

<br />
<b>Notice</b>: Undefined variable: argv in <b>/home/cobaltholidays/[#######/public_html/bin/cake.php](http://#######/public_html/bin/cake.php)</b> on line <b>12</b><br />
<br />
<b>Fatal error</b>: Uncaught TypeError: Argument 1 passed to Cake\Console\CommandRunner::run() must be of the type array, null given, called in /home/cobaltholidays/[######/public_html/bin/cake.php](http://#######public_html/bin/cake.php) on line 12 and defined in /home/cobaltholidays/[######/public_html/vendor/cakephp/cakephp/src/Console/CommandRunner.php:130](http://pontus.cobaltholidays.co.uk/public_html/vendor/cakephp/cakephp/src/Console/CommandRunner.php:130)
Stack trace:
#0 /home/cobaltholidays/[######/public_html/bin/cake.php(12)](http://#####/public_html/bin/cake.php(12)): Cake\Console\CommandRunner-&gt;run(NULL)
#1 {main}
thrown in <b>/#######/public_html/vendor/cakephp/cakephp/src/Console/CommandRunner.php](http://#########/public_html/vendor/cakephp/cakephp/src/Console/CommandRunner.php)</b> on line <b>130</b><br />

What is your command line when you run it successfully from the terminal? And what exactly is the configuration you’re using in your mail server setup to pipe it?

via ssh

bin/cake ticket

via cPanel Forwarder

|/home/cobaltholidays/pontus.cobaltholidays.co.uk/public_html/bin/cake.php ticket

The former uses bin/cake, the latter uses bin/cake.php. Did you try the forwarder without the .php?

i had tried without however that still didnt work.
i have now got it working to the point that the emails are recevied. However it still bounces an email back with a fail.