how to know the mail sent status using sendmail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to know the mail sent status using sendmail
# 1  
Old 09-08-2009
how to know the mail sent status using sendmail

Hi,
I am using sendmail command to send mail

This is the command i am using

cat <filename> | /usr/lib/sendmail -v <emailid>

I will put the contents in the file as body of the email

I want the subject also to be printed in the email

I want to know whether email has been successfully sent or not
to track in the log file

can anyone help me in this

Thanks in advance
# 2  
Old 01-10-2010
Bit late now but the usual method for seeing if a command succeeded is to catch the return code, e.g.:
Code:
command
RESULT=$?
echo RESULT = ${RESULT}

If the return code is zero then the command succeeded.

Another test you could do is to run mailq and ensure the queue is empty.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Proxy Server

How to send mail (sendmail) for php mail()?

PHP mail() function doesn't work. Nor does sendmail: loaded system configuration file /etc/msmtprc ignoring user configuration file /home/xi/.msmtprc: No such file or directory falling back to default account using account default from /etc/msmtprc host = xsi port = 25 proxy host = (not... (1 Reply)
Discussion started by: Xcislav
1 Replies

2. Shell Programming and Scripting

checking the status of sendmail

Hi All, I like to check the status of sendmail and take the appropriate action based on success / failure etc. I have gone through one of the thread where a suggestion is made to use RC for return code Following is the code: ================================== #!/usr/bin/bash export... (0 Replies)
Discussion started by: tmanda
0 Replies

3. UNIX for Dummies Questions & Answers

Does the mail command use sendmail?

The question is, Does the mail comman actually send using sendmail or something else? So I am trying to test if sendmail is set up. I used... cat testemail.txt | mail -s "test mail" myemail@test.com I used my email though I didn't get an error, but didn't get the email either. ... (2 Replies)
Discussion started by: wondernate
2 Replies

4. Shell Programming and Scripting

Checking the status of mail sent.

Hi, Is there any way to check the status of the mail sent or not.e.g mail -s "Error Message" abc@xyz.com <aaa/bbb/data.txt Can it return a status code which will confirm the delivery of mail sent?Please suggest. Thanks, Anil (1 Reply)
Discussion started by: anil029
1 Replies

5. Shell Programming and Scripting

mail or sendmail ?

1. I need to send emails using a shell script on linux. I want to use the most widespread method (the preferred method). Is one considered deprecated in favor of the other? Which, mail or sendmail ? 2. Now, without trying to favor mail in the first question: How can I include a From: mail... (1 Reply)
Discussion started by: limmer
1 Replies

6. Linux

Restrict mail from Sendmail

Hello All, i have configured sendmail and trying to set a limit on mail Ex: If i have send any mail to a email-if that doesn'e exists, i want that after trying for 3 days it should stops sending that mail to user and send a mail to the sender that " sending mail failed , any messaged... (1 Reply)
Discussion started by: saurabh84g
1 Replies

7. Solaris

sendmail mail server help

Hello guys, Am trying to enable/start sendmail in Solaris 10. I tried using scvadm and also did it using the /etc/init.d/sendmail restart but no effect. Just returns to the prompt. No errors nothing. I checked if it is running using ps -eaf | grep sendmail, not running :( . I checked the logs... (9 Replies)
Discussion started by: rcmrulzz
9 Replies

8. UNIX for Dummies Questions & Answers

EXIT STATUS on mailx/sendmail

Hi there I am using mailx command to send mails. I want to send some important files to team members and wud like to know if the team member has recd my email or not. How can I achieve this ? Currently my piece of code is uuencode ${FILE_NAME} ${FILE_NAME} >> mail_msg.txt mailx -s"test... (5 Replies)
Discussion started by: Amruta Pitkar
5 Replies

9. UNIX for Advanced & Expert Users

Forwarding mail with sendmail

Hello, I need to forward mail wich are in some users mailbox. The .forward redirection is working for all new mails but not for old. Is someone know how to do this ? Thanks (2 Replies)
Discussion started by: annececile
2 Replies

10. UNIX for Dummies Questions & Answers

blocking mail using sendmail

Hi, I am using sendmail 8.9.1 and trying to block email from certain domain/user. How could I do that? TQ (4 Replies)
Discussion started by: liyas
4 Replies
Login or Register to Ask a Question