Sending mail, status checking


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sending mail, status checking
# 1  
Old 01-07-2005
Question Sending mail, status checking

After I send a mail thr unix with following command

uuencode tmpFile | mailx -s "sub1" emailid

Yet, I havent received this mail at intended mail client.
In order to find out if the sent mail action resulted in failure,
I checked at

/usr/spool/mail/userid

But there also I couldnt find this mail with subject sub1 returned as failed delivery.

Is there any way to check whether sent mail was a successful operation?
# 2  
Old 01-07-2005
For starters, you can always check the value of $?. $? holds the return code (errno) of the last command processed.
Code:
uuencode tmpFile | mailx -s "sub1" emailid
if [ $? -ne 0 ] then ;
 echo "failed attempt. "
 exit 
fi

Also, try sending your message to an account outside of your company. For whatever reason, I cannot send messages from my clients unix server to my work email, but I can send them to an account such as Yahoo. Not sure if there are rules in place coming into my company or leaving the unix server but either way, one side wont allow mail to my work domain.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A shell script for checking the last image and sending it in attachment to mail

Hello every one. I use mutt : "mpack -s "Test" /home/pi/Pictures/2018-10-05_23_10_40.jpg my_email_addres " to send me a particular picture with the name of the data+jpg in a pictures folder, but this folder I use it for a timelapse proyect with more pictures , and what I need is... (2 Replies)
Discussion started by: maxbcn
2 Replies

2. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

3. Shell Programming and Scripting

Checking directory status

Can I use -ctime/-mtime to verify if a particular directory has been updated or not? I don't care about number of days. I just want to perform some operations only if the folder is modified (or it's metadata is modified), i.e. some files are added to the directory. This thread has a more... (1 Reply)
Discussion started by: Pramit
1 Replies

4. 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

5. Shell Programming and Scripting

Stop sending mail after certain number of mail

Hi guys... I am busy writing a script to notify me via an mail if my application is down. I have done that. Now I want this script to stop sending mails after five mails were sent but the script should keep on checking the application. When the application is up again that count should be... (5 Replies)
Discussion started by: Phuti
5 Replies

6. 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

7. Shell Programming and Scripting

Checking Status of PID

I'm developing a script that spawns many background processes that will be executing concurrently and need to check the exit status of each spawned process after it terminates. After starting the background process I can get the pid from $! which I can store in an associative array but how do I... (2 Replies)
Discussion started by: twk
2 Replies

8. UNIX for Dummies Questions & Answers

checking the status of file ftp

Hi, I m new to unix and I need a help in FTp-ing a file. My script is given below ftp -n <<END_SCRIPT open $FTP_HOST user $FTP_USER $FTP_PASSWD lcd $TEMPFOLDER cd $FTP_LOCATION put $1 bye END_SCRIPT exit_status=$? if ; then log "successfully FTPed the file" else... (5 Replies)
Discussion started by: MeeraNair
5 Replies

9. Shell Programming and Scripting

Checking Exit Status

I hope one of you smart people out there can help me with what seems like a real simple questing but I can't quite figure out. In a script I am doing a cmp on two files. I am trying to check the exit status with an if statement but can't seem to figure out the syntax. If the exit status is 1 I... (4 Replies)
Discussion started by: PrimeRibAndADew
4 Replies

10. Shell Programming and Scripting

checking for filesizes before sending

Hi there, I have a ksh script that send an sql to a database, exports the results to a directory, then send this file later after formation to an ftp server. Problem ... this file sometimes contains nothing, so i will like to extend my scripts to check the filesize and when = 0, then it exits... (2 Replies)
Discussion started by: jikyj
2 Replies
Login or Register to Ask a Question