Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6070367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:55:31+00:00 2026-05-23T09:55:31+00:00

I am attempting to do some custom email forwarding. #1 I am on a

  • 0

I am attempting to do some custom email forwarding. #1 I am on a shared server, which is using qmail, and optionally procmail.

What I am trying to accomplish is some custom email forwarding of one address, based on a schedule. For example, I have a schedule of employees that are working on each weekday, and I have a php script that selects a random employee’s email address that is working today.

So I’m trying to just call that script in procmail, and output the result(which is a single email address) on the forward line:

Example:

#Something
LOGFILE=/usr/home/myname/procmail-log
VERBOSE=yes
EXITCODE=99
MAILDIR=/usr/boxes/myname
DEFAULT=/usr/boxes/myname/mybox
SHELL=/bin/sh
MYVAR=$(php -q /usr/home/myname/testemail/emailtester.php)

:0
! $MYVAR

This is not working. At all. I have also tried:

MYVAR=`php /usr/home/myname/testemail/emailtester.php`

as well as just piping it into the forward line:

:0
! |php /usr/home/myname/testemail/emailtester.php

I am COMPLETELY out of my element here…
I tried to not even use procmail, and I just piped the whole email over to a php script, from qmail. I need the headers to stay intact, like a normal forward, and that proved to be difficult with PHP, and a little beyond my scope.( I managed to create an infinite email loop) So, I would rather not try that again.

I could just try to script this in perl, which I have never used, but I need the schedule to be administerable from a web interface, or at least in a user friendly way.

Any help, or suggestions would be appreciated at this point, thanks

EDIT:

Well, since I cant put code in a comment, I’ll just edit here.

Now getting this in my log:

Folder: /usr/local/bin/php /usr/home/idnani/testemail/emailtester.ph     1679
"rocmail: Executing "/usr/local/bin/php,/usr/home/idnani/testemail/emailtester.php
Could not open input file: /usr/home/idnani/testemail/emailtester.php

When I use with :0fw I get:

"rocmail: Executing "/usr/local/bin/php,/usr/home/idnani/testemail/emailtester.php
Could not open input file: /usr/home/idnani/testemail/emailtester.php
procmail: [69907] Thu Jun 16 14:04:17 2011
procmail: Program failure (1) of "/usr/local/bin/php"
procmail: Rescue of unfiltered data succeeded

EDIT: Figured it out!

Found the correct way after MUCH trial and error.

Don’t even use the pipe at, all, and you do need the ! forward symbol:

Final Rule:

:0
! `/usr/local/bin/php -f $HOME/emailtest/emailtester.php`

So simple… I’m a little mad it took me hours to figure this out, thanks everyone for helping to point me in the right direction!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:55:32+00:00Added an answer on May 23, 2026 at 9:55 am

    Found the correct way after MUCH trial and error.

    Don’t even use the pipe at, all, and you do need the ! forward symbol:

    all this rule does is ask the php script for a single email, and then forwards to that email.
    Final Rule:

    :0
    ! `/usr/local/bin/php -f $HOME/emailtest/emailtester.php`
    

    So simple… I’m a little mad it took me hours to figure this out, thanks everyone for helping to point me in the right direction!

    Michael’s answer looks like it should work, and maybe it does under a different circumstance? I couldn’t get it to, which is why I am answering this myself..

    New edit:

    Note: You can still retrieve the whole email in php via STDIN

    Note: you can put /usr/local/bin/php in your script itself like this
    on the first line:

    #!/usr/local/bin/php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hopefully some Custom Control Designers/Builders can help I'm attempting to build my first custom
I'm attempting to display some text in my program using (say) Windows GDI and
I'm attempting to display some text in my program using (say) Windows GDI and
I am attempting to pull some information from my tnsnames file using regex. I
Does attempting to develop some sort of game, even just as a hobby during
I'm attempting to add some text to the directions results the Google Maps API
I have been attempting to write some routines to read RSS and ATOM feeds
I'm attempting to put together some basic report screens. I've got some fairly complicated
Attempting to deploy a MOSS solution to a UAT server from dev server for
Attempting to insert an escape character into a table results in a warning. For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.