- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to get the Exit Status in sendmail.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2007 10:23 PM
тАО11-29-2007 10:23 PM
How to get the Exit Status in sendmail.
I have written small shell script which sends an e-mail using sendmail command.
Need to check the exit status after the completion of the sendmail.
Read the "sendmail" manpage and found some of the exit status defined. But I am unable to caputre the exit status using the "$?". Kindly guide how to capture the same.
Here is my Script
echo "To: raghu@xyz.com " > mesg
echo "From: raghu@abc.com" >> mesg
echo "Subject: Mail using sendmail" >> mesg
echo "Content-type: mixed/multipart base64;"
echo "" >> mesg
echo "Message file attached" >> mesg
echo "" >> mesg
cat mesg|/usr/sbin/sendmail -t
echo $?
Regards,
Raghu
- Tags:
- exit status
- sendmail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2007 01:04 AM
тАО11-30-2007 01:04 AM
Re: How to get the Exit Status in sendmail.
Your script worked (and returned valid exit codes) for me. As you know, the possible exit values are defined in the manpages and can be mapped from '/usr/include/sysexits.h'.
For example if I use a recipient of "me" in the "To" line, I see an exit value of 67 (EX_NOUSER).
For efficiency, eliminate your 'cat' and write:
/usr/sbin/sendmail -t < mesg
Regards!
...JRF...
- Tags:
- evil cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-02-2007 11:24 PM
тАО12-02-2007 11:24 PM
Re: How to get the Exit Status in sendmail.
Thanks for the reply.
This works for the id which doesnot have the @domainname.
Is it possible to get the status if an invalid email id eg. raghu@123.com
(which does not exists) in the To: field is given...
Regards,
Raghu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2007 12:50 AM
тАО12-03-2007 12:50 AM
Re: How to get the Exit Status in sendmail.
You can always get the status. But errors in delivery are probably not detected in sendmail but by the bounced mail message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2007 05:50 AM
тАО12-03-2007 05:50 AM
Re: How to get the Exit Status in sendmail.
You might want to see mail.log file. You can turn up the log level if you need increased detail to track a scripting problem by changing sendmail.cf and restarting sendmail.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2007 06:43 AM
тАО12-03-2007 06:43 AM
Re: How to get the Exit Status in sendmail.
> Is it possible to get the status if an invalid email id eg. raghu@123.com
(which does not exists) in the To: field is given...
Errors like that, as noted, will probably be reported not as a return status, but as an undeliverable message noted in '/var/adm/syslog/mail.log'.
The manpages and the contents of '/usr/include/sysexits.h' will describe what return codes AND the reason they may be returned. I suggest examining them.
Regards!
...JRF...