Link to home
Create AccountLog in
Windows Server 2003

Windows Server 2003

--

Questions

--

Followers

Top Experts

Avatar of marchopkins
marchopkins🇺🇸

Sendmail Autoresponder
I have perused a few links on how to set up an auto-responder to a message sent to a particular client (info@yourdomain.com).

What i want to happen is if a customer sends a message to a specific e-mail address, the person sending the message will get back, right away, a generic message as an acknowledgment  "We have received your message and will get back with you ASAP"  or something to that effect.

The links i found were confusing.   Can someone point me in the right direction?

Using Sendmail 8.12.11  Redhat Linux Enterprise.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Arty KArty K🇰🇿

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Arty KArty K🇰🇿

/tmp/auto.sh should be executable:

chmod +x /tmp/auto.sh

Avatar of Arty KArty K🇰🇿

Alternatively, if you are also using Cyrus Imapd on the same host, you may create 'info' user and define a 'Sieve' server-side mail filtering script, that will always send auto-response (this kind of autoresponse can be done with 'vacation' lautoresponder), like:

require "vacation";

vacation
:subject "Hello from autoresponder"
   "Welcome";

Avatar of marchopkinsmarchopkins🇺🇸

ASKER

I'll give this a try..thanks.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of marchopkinsmarchopkins🇺🇸

ASKER

Seemed pretty straight forward...I'm getting the following messages

1.  while tailing the logfile:      Sep  9 09:05:04 mail sendmail[20467]: o89D541O020467: from=<user@domain.com>, size=13762, class=0, nrcpts=1, msgid=<49D275F1-AA0A-4D74-AE0F-D81BB9CAF29D@domain.com>, proto=ESMTP, daemon=Daemon1, relay=pix525-domain.com [208.65.69.98]
Sep  9 09:05:04 mail sendmail[20468]: o89D541O020467: to=/temp/auto.sh, ctladdr=<autotest@domain.com> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=*file*, pri=44024, dsn=5.0.0, stat=Can't create output
Sep  9 09:05:04 mail sendmail[20468]: o89D541O020467: o89D541O020468: DSN: Can't create output
 
2.  message back to my mail client:       ----- The following addresses had permanent fatal errors -----
/temp/auto.sh
   (reason: Can't create output)
   (expanded from: <autotest@domain.com>)

  ----- Transcript of session follows -----
550 5.0.0 /temp/auto.sh... Can't create output
Reporting-MTA: dns; mail.domain.com
Received-From-MTA: DNS; pix525-domain.com
Arrival-Date: Thu, 9 Sep 2010 09:05:04 -0400

Final-Recipient: RFC822; autotest@domain.com
X-Actual-Recipient: X-Unix; /temp/auto.sh
Action: failed
Status: 5.3.0
Diagnostic-Code: X-Unix; 73
Last-Attempt-Date: Thu, 9 Sep 2010 09:05:04 -0400

I think i may not understand your step 2 "Creating a Script".   Thanks

Avatar of Arty KArty K🇰🇿

You forget to add a veritcal line in etc/aliases, should be:

info: |/tmp/auto.sh

Probably your aliases line looks like:

info: /tmp/auto.sh



Avatar of marchopkinsmarchopkins🇺🇸

ASKER

i'll give it a try.  I believe i actually did that at first, but i'll go over it again.



Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of marchopkinsmarchopkins🇺🇸

ASKER

after adding the vertical line here is what the logfile generated:

Sep 13 08:31:00 mail sendmail[12457]: o8DCV0fm012457: from=<user@somedomain.com>, size=13752, class=0, nrcpts=1, msgid=<81301B2C-6105-4D36-BF7D-28E6A8431735@domain.com>, proto=ESMTP, daemon=Daemon1, relay=pix525-domain.com [208.X.X.X]
Sep 13 08:31:00 mail smrsh: uid 8: attempt to use "auto.sh" (stat failed)
Sep 13 08:31:00 mail sendmail[12458]: o8DCV0fm012457: to=|/temp/auto.sh, ctladdr=<autotest@domain.com> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=prog, pri=44015, dsn=5.0.0, stat=Service unavailable
Sep 13 08:31:00 mail sendmail[12458]: o8DCV0fm012457: o8DCV0fm012458: DSN: Service unavailable





Avatar of Arty KArty K🇰🇿

1) Put your script into /etc/smrsh/ and change aliases accordingly.
2) Try to disable selinux temporary (setenforce 0). If 1) doesn't work.

Regards,
Arty

Avatar of marchopkinsmarchopkins🇺🇸

ASKER

I'll give it a go.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of marchopkinsmarchopkins🇺🇸

ASKER

1 did not work....

I have no /etc/selinux file
I tried to run the command setenforce 0...  Command not found

I also checked the bootloader   /boot/grub   to try to find the grub.conf file....no file there either.


Any other suggestions?

Avatar of marchopkinsmarchopkins🇺🇸

ASKER

BTW, here is the error that i am getting after moving the file:

Sep 13 09:48:46 mail sendmail[14063]: o8DDmkx5014062: to=|/etc/smrsh/auto.sh, ctladdr=<autotest@domain.com> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=prog, pri=33096, dsn=5.3.0, stat=unknown mailer error 127
Sep 13 09:48:46 mail sendmail[14063]: o8DDmkx5014062: o8DDmkx5014063: DSN: unknown mailer error 127


I moved the auto.sh and the care.txt file into the directory you suggested.  Here are the contents of the files.


care.txt:    (it just accured to me that i should probably remove the --[cut}--)

--[cut]--
From: info <autotest@grid4.com>
Subject: this is autoresponder message

Welcome.
--[cut]--


auto.sh:   (I only have the word  "attached"  in this file.)

attached    
 

Avatar of Arty KArty K🇰🇿

Did you disable SELinux?
Also can you repost a shell script.

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of marchopkinsmarchopkins🇺🇸

ASKER

the commands that you suggested did not work.   See my post prior to the last one.  


Repost a shell script...??

Avatar of Arty KArty K🇰🇿

I mean you didn't attach your real script and I can't check it.

I guess the problem is here: ctladdr=<autotest@domain.com>

Most probably your server has a fake hostname (either not in DNS or just non existing). And sendmail is unable to resolve it. Please check your /etc/mail/sendmail.cf for a line starting with DS<servername here>, if there is 'localhost' or something like - it's a fake name, you should change it to real domain name, then restart sendmail.

Regards,
Arty

Avatar of marchopkinsmarchopkins🇺🇸

ASKER

Ok, i'll do the best i can to get the info posted here.   Here goes:   (I've never done a script in the past)

Here is the content of the Alias File in /etc/alias:
autotest:       |/etc/smrsh/auto.sh

Here is the content of the /etc/smrsh/auto.sh file:
#!/bin/bash
MESSAGE=/etc/smrsh/care.txt
FROM=autotest@domain.com
# our stdin is sender's message with headers
while read line
do
  # we should extract return path only
  case $line in
    ( Return-Path:* )
       # TO is a variable to keep return path
       TO=${line##Return-Path: }
       break
       ;;
  esac
done
# Some checks to avoid mail loops:
# skip empty <>, my own, postmaster and MAIER-DAEMON addresses
case $TO in
  ( *$FROM* | '<>' | *MAILER* | *DAEMON* | *DELIVERY* )
    exit 0
    ;;
esac

# Now compose new message and send it to TO
(echo To: $TO; cat $MESSAGE) | /usr/sbin/sendmail -t -f $FROM

Here is the content of the care.txt file in /etc/smrsh/care.txt:
From: info <autotest@grid4.com>
Subject: this is autoresponder message

Welcome.

Here is the message that i see when I tail the logfile on the server:

Sep 14 08:54:18 mail sendmail[29457]: AUTH=server, relay=pix525-domain.com [208.x.x.x], authid=<sender>, mech=PLAIN, bits=0
Sep 14 08:54:19 mail sendmail[29457]: o8ECsIrW029457: from=<user@someother.com>, size=13740, class=0, nrcpts=1, msgid=<EC671B83-9E19-464A-8046-61BCD9BE9115@grid4.com>, proto=ESMTP, daemon=Daemon1, relay=pix525-domain.com [208.x.x.x]
Sep 14 08:54:19 mail sendmail[29462]: o8ECsJs3029462: Authentication-Warning: mail.domain.com: mail set sender to autotest@domain.com using -f
Sep 14 08:54:19 mail sendmail[29462]: o8ECsJs3029462: from=autotest@domain.com, size=87, class=0, nrcpts=0, msgid=<201009141254.o8ECsJs3029462@mail.domain.com>, relay=mail@localhost
Sep 14 08:54:19 mail sendmail[29458]: o8ECsIrW029457: to=|/etc/smrsh/auto.sh, ctladdr=<autotest@domain.com> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=prog, pri=44003, dsn=2.0.0, stat=Sent

it appears that the message was sent, but i did not receive a message in my inbox.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of Arty KArty K🇰🇿

Hi.

I had checked the autoresponder before initial post. If it doesn't work for you - you are doing something wrong.
Without complete non-modified logs it's hard to guess what is going wrong.

Regards,
Arty

Avatar of Arty KArty K🇰🇿

You may also try to make a copy of your outgoing mail message with this line:

(echo To: $TO; cat $MESSAGE) | tee /tmp/message.$$ | /usr/sbin/sendmail -t -f $FROM

Then see what is in that file after testing. Then try to send this file manually with 'cat /tmp/message.??? sendmail -t -f autotest@domain.com' (just change ??? to real number).

And provide logs of manual sending too.

Regards,
Arty

Avatar of marchopkinsmarchopkins🇺🇸

ASKER

thanks

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.

Windows Server 2003

Windows Server 2003

--

Questions

--

Followers

Top Experts

Windows Server 2003 was based on Windows XP and was released in four editions: Web, Standard, Enterprise and Datacenter. It also had derivative versions for clusters, storage and Microsoft’s Small Business Server. Important upgrades included integrating Internet Information Services (IIS), improvements to Active Directory (AD) and Group Policy (GP), and the migration to Automated System Recovery (ASR).