The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Electronic Mail Piped to Perl Script Not Executing with Module Reference

Discussion in 'cPanel Developers' started by Anthony Brian Mallgren, Dec 13, 2015.

  1. Anthony Brian Mallgren

    Anthony Brian Mallgren Active Member

    Joined:
    Dec 12, 2015
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United States
    cPanel Access Level:
    Website Owner
    Twitter:
    I currently have a domain in cPanel configured to pipe electronic mail to a Perl script, although the script does not seem to execute when there is any use statement (module references).

    It seems to execute when I simply remove all of the use statements. It also seems to execute with the use statements when I run the script through SSH.

    I am currently utilizing GoDaddy as a hosting solutions provider.

    Any ideas?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you let us know the exact steps we can take to reproduce the issue? Have you reported the problem to your web hosting provider?

    Thank you.
     
  3. Anthony Brian Mallgren

    Anthony Brian Mallgren Active Member

    Joined:
    Dec 12, 2015
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United States
    cPanel Access Level:
    Website Owner
    Twitter:
    Steps to Reproduce
    1. Login to cPanel
    2. Click File Manager
    3. Create a new file in an appropriate directory
    4. Create some type of test file to validate that performs some standard action (I have a PHP file which writes to a database)
    5. Click Save Changes
    6. Click the Close button

    7. Create a new file in an appropriate directory
    8. Enter #!/usr/bin/perl as the first line
    9. Use the Perl "open" command to call the file that was previously created (in my case, it is the PHP file which writes to a database)
    10. Click Save Changes
    11. Click the Close button

    12. Return to the cPanel Main tab/window
    13. In the "Email" section, click Default Address
    14. Ensure the proper domain is selected for the field that says "Send all unrouted email for the following domain:" above it
    15. Under Advanced Options, select "Pipe to a Program"
    16. Enter the path to the file created in steps 7-11
    17. Click the Change button

    18. Send a test electronic mail message to the domain for an address that may be handled by the script in the configuration created in steps 12-17 (in my case, it seemingly causes the script to execute, as confirmed by the PHP script that is called writing to a database)

    19. Return to the cPanel Main tab/window
    20. In the Software section, click Perl Modules
    21. Copy and Paste "Email::Simple" (not including the quotes) into the field under "Install a Perl Module"
    22. Click the Install Now button
    23. Confirm that you see "Successfully installed [...]" after the installation has completed

    24. Return to the cPanel File Manager tab/window
    25. Open the file created in steps 7-11 for editing
    26. Add "use Email::Simple;" to the file
    27. Click Save Changes

    28. Send a test electronic mail message to the domain for an address that may be handled by the script in the configuration created in steps 12-17 (in my case, it does not seem to cause the script to execute successfully, as confirmed by the PHP script failing to write to a database)
    Result

    The script seems to execute successfully without module references, but not with a reference to an installed module.

    Expected Result

    Both the versions of the script, without and with module references, should execute successfully.

    Additional Notes

    When called by means of SSH, the version of the file which results after completing step 27 seems to execute successfully, confirmed by the PHP script seemingly resulting in an additional record in a database.
     
  4. Anthony Brian Mallgren

    Anthony Brian Mallgren Active Member

    Joined:
    Dec 12, 2015
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United States
    cPanel Access Level:
    Website Owner
    Twitter:
    I have not contacted the hosting provider for this specific issue yet. Per my experience, and with an offering such as this, there seems to be the habit of the hosting provider first pointing the customer to the software vendor for which the customer is experiencing a seeming issue with. In this case, I believe it would be appropriate for cPanel to confirm the functionality of the product, as from an infrastructure standpoint, everything seems sound. It appears, to me, more of a configuration or functionality issue.

    If someone would provide me with the technical specification of how the product functions, and explain why the different execution methods result in different outcomes, I could perhaps take the information back to the hosting provider.
     
  5. Anthony Brian Mallgren

    Anthony Brian Mallgren Active Member

    Joined:
    Dec 12, 2015
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United States
    cPanel Access Level:
    Website Owner
    Twitter:
    I was able to work around this by utilizing a Python script, using the email.parser functionality and piping that to a PHP script.
     
Loading...

Share This Page