Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kbadgley's avatar

How to create email piping to Laravel 5.5 in Shared Hosting with cPanel

I am looking to try to create an email pipe back to my laravel application... So far, I was able to get the email to actually send to the pipe, however once in the pipe, I can't get it to run correctly. https://www.sitepoint.com/piping-emails-laravel-application/ is what I used, but have "reconfigured it" to meet 5.5 needs (Including using artisan commands)... However I get the following error when it goes into the __construct() function...

PHP Notice: Undefined index: argv in /home/server/public_html/vendor/symfony/console/Input/ArgvInput.php on line 53 PHP Warning: array_shift() expects parameter 1 to be array, null given in /home/server/public_html/vendor/symfony/console/Input/ArgvInput.php on line 57

Because of this, the handle() function never gets called....

Does anyone have an idea of how I can go about dealing with this?? (I'm not sure if it's an issue because of the register_argc_argv variable being off, because of Shared Hosting... but if so... that would be a big problem... Is there any way to get around this error?? (My application actually uses this functionality very specifically in regards to returned emails.)

0 likes
11 replies
kbadgley's avatar

The problem I have is that... I have the user's names as the return address, so I can filter it to know who sent it back... so.... [email protected] -> creates a record that stores in the database telling me that the person who is "username" said something back...

Snapey's avatar

isnt that just their 'from' address?

you can get all the headers with imap

kbadgley's avatar

Ideally I don't want a specific catch all.... Think of it more as a.... Craigslist-ish type of piping... where each initiating user is just referenced by their username (Craigslist uses some hashed email, that they connect with the user... I'm keeping it simple with just a generic username)

Snapey's avatar

You mean it looks like each user has their own inbox and that all replies go to a specific address?

By not using a mailbox, don't you see that you have just created a catch-all email address anyway?

kbadgley's avatar

I have 3 emails that aren't considered "catch-all", that do receive, however I use the returned "to:" in the email to parse out and allow the users to email to and from each other without knowing their actual email.. (Unless of course they have a signature, or something of that sort..)

to: [email protected] from: [email protected]

When send back, I parse those 2 pieces, and get instead...

to: snapey@real_email.com from: [email protected]

and the body of the message just chains on...

Snapey's avatar

back to your original question, looks like there is some issue with the way you created the command. Have you looked at any other artisan command tutorials.

Back to my approach, how will you recieve emails for user1@appdomain.com, user2@appdomain.com etc etc without creating either individual mail addresses in cpanel, or a catch-all account?

kbadgley's avatar

I created the command following the link.... then re-created it following the 5.5 docs..

Direct from cPanel setting...

cPanel will forward all unrouted email for “appdomain.com” to “|/home/server/public_html/artisan parsee

this command triggers the php://stdin to read in the email to the application.

Because instead of bouncing emails, the application is setup to read them in.

Snapey's avatar

Who spoke of 'bouncing emails' ?

kbadgley's avatar
kbadgley
OP
Best Answer
Level 1

Looks like the issue is actually a bad artisan command... For some reason my __construct() function is never resolving fully, to call the handle() function... The rest of my stuff works.... So I opened a new discussion in regards to the artisan command... and seeing if there is something else happening that could be a bug or something...

I'll write up an email piping tutorial when I get done with this, that matches the new 5.5 formatting...

ayazsarwar's avatar

Hey @kbadgley, Did you ever created any tutorial afterwards?? I'm sort of stuck in a similar thing.

Please or to participate in this conversation.