SENDMAIL/.forward: Forwarding to programs

SENDMAIL/.forward: Forwarding to programs

Post by Ralph Jaco » Sat, 13 Feb 1999 04:00:00

I'm posting this for a friend who is currently nntp impared:


I am having a problem under FreeBSD 2.2.2-RELEASE regarding forwarding
to an external program via the .forward file.  Whenever an email is
received, I need it to be passed to my custom program as well as
stored in that user's mailbox.  Thus, I would expect the .forward file
to be something like:


The problem is that when I create this .forward file and I send email
to the account, a message is returned that says:

   Line 2: |/the/path/myprogram myemail is unsafe for mailing

I search the net and in related FAQs and there were a number of ideas
that seemed promising (rsmsh configuration, listing valid sheels in
/etc/shells, etc.), but none of them turned out to be the problem.  I
tried to work around it by creating an alias in /etc/aliases that

    myprog: |/the/path/myprogram

Then in each .forward file I put:


This seemed to work just fine until I ran into a problem today.  If
someone sends a message to two users on my system in a single SMTP
session and both users have myprog in the .forward file, only the
first user will actually have the message forwarded to "myprog."  The
myprog program is NOT executed for the second user.  

forward file, sendmail will leave copies of the email in both of their
mailboxes, but will execute "myprog" only once with UID=user1.  Myprog
is never executed with UID=user2.

I suppose this makes sense since if "myprog" was a user he wouldn't
want two forwarded copies of the same message.  However, I need my
program to be executed once for each user, even if it's the exact same

Thus I am looking for a way to solve my problem.  I see two options
for solving the problem:

1. Figure out how to configure sendmail to allow me to put a program
in each user's .forward file without reporting the "unsafe" error

2. If possible, I'd like to use the current solution where all user's
.forward files reference an alias in /etc/aliases which references the
program; that way if I ever change the location of the program I just
need to update the /etc/aliases file and everyone will be "updated"
immediately.  But I need to know if there's any way to tell sendmail
to execute "myprog" multiple times, once for each user receiving the
mail, executing as that user's UID.

Any and all help will be greatly appreciated.  If possible, please

  Craig Steiner


1. Sendmail .forward, mailing to programs

I have some problems with forwarding to programs with sendmail .forward
I just want to forward the mail to a program, but sendmail responds with the
following error:

The original message was received at Fri, 22 Feb 2002 10:31:53 GMT from lrpc
[62.xx.xx.xx] (may be forged)
----- The following addresses had permanent fatal errors ----- "|./sendsms"

--- The transcript of the session follows ---
550 /disk2/mailusers/lm002/.forward: line 2: "|./sendsms"... The address

I can't seem to find a solution to this problem. Can anyone help me?

2. RTTI not supported?

3. sendmail forwarding to another sendmail without DNS?

4. Mounting a Sun formatted disk on a linux system???

5. mail forwarding problem with ".forward" file

6. Problems with SCSI hard drive while booting

7. mail forward problem in RH71 with procmail or .forward

8. EISA SCSI on Prosignia VS

9. Slackware 1.2.13 .forward doesnt forward

10. ip-forwarding && dns-forwarding

11. .forward file: possible to forward and also keep mail?

12. Q: Does IP forwarding forward ARP ?

13. Using "ipchains -P forward DENY" instead of disabling ip-forwarding?