-   Linux - Newbie (
-   -   Sendmail Aliases (

sunnyyang 04-01-2008 04:59 AM

Sendmail Aliases

I am configuring Sendmail Aliases to let system run a script after receiving a mail.

But it seems not working, message re-direction is ok, here is the details:

root: another-user --- working
root: |/script --- not working

Anybody wants to help me? thank you. :)


bathory 04-01-2008 05:37 AM


root: "|/script"
i.e. use the quotation marks around the full path to the script you want to run and see if it works.
After editing /etc/mail/aliases, run "newaliases" and restart sendmail.


sunnyyang 04-01-2008 09:20 AM

Thank you.
Thank you Bathory.

I tried this, still not working.

Here is a part of my aliases file.
# Person who should get root's mail
#root: marc
root: yangg
yangg: "|/tmp/"

Messages sent to root can be forwarded to yangg, but if you address yangg nothing happens, yangg cannot receive this message either.

script is very simple: touch /tmp/aliases.tst, that's it.

I really don't have idea.

If you need to view my file, please let me know..

Thank you in advance.


bathory 04-01-2008 09:47 AM

Edit aliases and in the line:

yangg: "|/tmp/"
remove the colon ":" at the end of the script name. The line should look like this:

yangg: "|/tmp/"
Also make sure that the script is executable:

chmod +x /tmp/

sunnyyang 04-01-2008 10:24 AM

Hi Bathory,

Excution permission has been granted to the script and the colon is also removed.

After that, I run newaliases, restart sendmail sucessfully. But ... no good.

Anything should I do with or


bathory 04-02-2008 01:56 AM

Take a look at the log files /var/log/maillog, /var/log/messages or whatever other log files your distro uses to see if you find any clues why the aliases is not working.
What distro are you using btw?
I don't think you have to do anything with or, since normal usernames aliases work.

sunnyyang 04-02-2008 02:15 AM

Log analysis
Sendmail Log
1. Apr 2 15:06:03 ts3 sendmail[5687]: alias database /etc/aliases rebuilt by root
2. Apr 2 15:06:03 ts3 sendmail[5687]: /etc/aliases: 65 aliases, longest 14 bytes, 655 bytes total
3. Apr 2 15:06:14 ts3 sendmail[5707]: alias database /etc/aliases rebuilt by root
4. Apr 2 15:06:14 ts3 sendmail[5707]: /etc/aliases: 65 aliases, longest 14 bytes, 655 bytes total
5. Apr 2 15:06:14 ts3 sendmail[5719]: starting daemon (8.12.8): SMTP+queueing@01:00:00
6. Apr 2 15:06:14 ts3 sm-msp-queue[5728]: starting daemon (8.12.8): queueing@01:00:00
7. Apr 2 15:07:00 ts3 sendmail[5733]: m32770ow005733: from=root, size=78, class=0, nrcpts=1,
8. msgid=<>, relay=root@localhost
9. Apr 2 15:07:00 ts3 sendmail[5735]: m32770Da005735: from=<>, size=351, class=0, nrcpts=1, msgid=<>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain []
10. Apr 2 15:07:00 ts3 sendmail[5733]: m32770ow005733: to=yangg, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30068, relay=[] [], dsn=2.0.0, stat=Sent (m32770Da005735 Message accepted for delivery)
11. Apr 2 15:07:00 ts3 smrsh: uid 8: attempt to use "" (stat failed)
12. Apr 2 15:07:00 ts3 sendmail[5736]: m32770Da005735: to="|/tmp/", ctladdr=<> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=prog, pri=30564, dsn=5.0.0, stat=Service unavailable
13. Apr 2 15:07:00 ts3 sendmail[5736]: m32770Da005735: m32770Da005736: DSN: Service unavailable
14. Apr 2 15:07:00 ts3 sendmail[5736]: m32770Da005736: to=user1\t\t, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31588, dsn=2.0.0, stat=Sent

Yes, normal aliases works. The Aliases seemed to be triggered, but failed in running the script. It looks like that statement "|/tmp/" was treated as an address instead of a command.

For our convinience to talk, I hereby numbered the log.

What is "Distro"? Basically, besides access file and aliases it's all default in Redhat9.


bathory 04-02-2008 03:32 AM

Distro is the Linux distribution you use, so you've answered it's RH 9. Anyway looking at the logs smrsh looked suspicious, so doing a little googling, I found this.
So I guess you need either to create the symlink mentioned there, or disable smrsh, in that case you need to rebuild your

sunnyyang 04-02-2008 11:00 AM

Hi Bathory,

It's done!

I created a link under /etc/smrsh pointing to my script according to the following information:
To allow the procmail program /usr/bin/procmail, use the following commands:
[root@deep] /# cd /etc/smrsh
[root@deep ]/smrsh# ln -s /usr/bin/procmail procmail

This will allow the mail and procmail programs to be run from a user's .forward file or an aliases file which uses the program syntax.
This information is from

But I got to switch to this link exactly from the webpage you passed to me. You have been always on the right direction, expert!!

Thank you.

I pasted all these meant to share with other people may need this.

Thank you all.

Case closed.

Thank you again Bathory!! I hope I can help people like how I was helped.


bathory 04-02-2008 01:50 PM

You are welcome. I'm glad you've made it.


All times are GMT -5. The time now is 11:32 PM.