Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like all mail sent to a particular alias on a Linux machine to be processed by a perl script but sendmail is giving me a "Service unavailable" error and I don't understand what I'm missing.

I created my script (right now, this just prints its parameters to /tmp/email.txt) and added a symbolic link to it in /etc/smrsh.

Then I added this to /etc/aliases:

mailtest: |

and ran newaliases afterwards. Note that I've also tried mailtest: |/etc/smrsh/ which gave the same results. I've also tried copying the actual script into /etc/smrsh rather than a link, same results again.

When I send mail to the mailtest alias, the file in /tmp never gets created, and I get this in /var/log/maillog:

Nov  1 14:43:59 localhost sendmail[24839]: qA1IhwHm024839: from=<xxx@xxx>, size=284, class=0, nrcpts=1, msgid=<201211011843.qA1IhwHm024839@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=[]
Nov  1 14:43:59 localhost smrsh: uid 8: attempt to use ""
Nov  1 14:43:59 localhost sendmail[24850]: qA1IhwHm024839: to=|, ctladdr=<mailtest@xxx> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=prog, pri=30570, dsn=5.0.0, stat=Service unavailable
Nov  1 14:43:59 localhost sendmail[24850]: qA1IhwHm024839: qA1IhxHm024850: DSN: Service unavailable
Nov  1 14:44:00 localhost sendmail[24850]: qA1IhxHm024850: to=<xxx@xxx>, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=31594, [<IP addr>], dsn=2.0.0, stat=Sent (qA1Ii4127508 Message accepted for delivery)

I get an email message describing the failure, which says:

The original message was received at Thu, 1 Nov 2012 14:58:16 -0400
from [<ip address>]

   ----- The following addresses had permanent fatal errors -----
    (reason: Service unavailable)
    (expanded from: <mailtest@xxx>)

   ----- Transcript of session follows -----
smrsh: "" not available for sendmail programs
554 5.0.0 Service unavailable

Why will smrsh not execute my script?

Update: Answering questions in comments.

I've copied the script to /etc/smrsh and removed the link. The file permissions are 0700 (also tried 0755) and the first line is #!/usr/local/bin/perl which is correct. There is only one file in /etc/smrsh. The ls -l output:

[main:g:64] xxx:/etc/smrsh# ls -l
total 4
-rwx------. 1 root root 281 Nov  1 16:35
share|improve this question
What are the permissions on – mdpc Nov 1 '12 at 19:38
Does the program first line have the appropriate and functional path to the PERL program? – mdpc Nov 1 '12 at 19:42
Also you might want to include the ls -l of /etc/smrsh directory. – mdpc Nov 1 '12 at 19:43
@mdpc Thanks for your responses - I've updated the question with the answers. – Graeme Perrow Nov 1 '12 at 20:43
First disable FEATURE(smrsh) from your, rebuild and restart sendmail. Then test whether your script works. If it does, or when it does, then come back and make it work with smrsh. But first check whether it works without it. – adamo Nov 3 '12 at 8:13

Try changing the permission of /etc/smrsh/ to 755 and I think you'll have more success. You might want to restart sendmail just to be sure things are properly initialized and configured.

share|improve this answer
Thanks, but nope. Tried changing permissions and restarting sendmail, same result. – Graeme Perrow Nov 1 '12 at 21:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.