send an email from batch file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers send an email from batch file
# 1  
Old 11-05-2011
send an email from batch file

My batch files run every day, it moves files from servers to my local computer, can I have a confirmation email sent to me from this batch file saying if the job failed or successes? Thank you for your help!
# 2  
Old 11-05-2011
Yes you can send email from the script .
As follows
Code:
$mailx -s "subject goes here" user@SomeDomain.TLD  < body.txt

# 3  
Old 11-05-2011
this line is all what i need in my file right? what type of script is this? what name should i save it under? thank you!
# 4  
Old 11-05-2011
Quote:
Originally Posted by idiazza
this line is all what i need in my file right? what type of script is this? what name should i save it under? thank you!
This line in itself is not a complete script it's just a small snippet which is responsible of sending an email
It's totally up to you to name it whatever you want
for an example myscript.sh
Make it executable
Code:
$chmod u+x myscript.sh

# 5  
Old 11-07-2011
Hello, I use to make this way:

Code:
echo "Test" | mail -s "from shell" user@domain.com

Regards.
# 6  
Old 11-08-2011
this mail command never worked for me , i used my official id and also gmail id , i never got a email . do we need to install any other lib?
# 7  
Old 11-08-2011
You need to configure exim.

On a Debian machine is this way: dpkg-reconfigure exim4-config

Regards.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove bad records from file and move them into a file then send those via email

Hi my requirement is that i want pull the bad records from input file and move those records in to a seperate file. that file has to be sent via email.. any suggentions please (1 Reply)
Discussion started by: sxk4999
1 Replies

2. Shell Programming and Scripting

need to zip 2 GB file and send it via email

i want to zip the 2GB file and send it via email from unix machine using uuencode. could you please suggest whether it will possible or not and also command to do it. (3 Replies)
Discussion started by: mail2sant
3 Replies

3. Shell Programming and Scripting

Read file and send email

I have a file like this. I need to ues this file to send emails to the appropriate ID/group. For instance in the first line - Subject should be --> "A1.csv - ABC" - Body should be --> File A1.csv has changed. - Email should be sent to A1@xyz.com,A3@xyz.com Lookup.csv: ... (1 Reply)
Discussion started by: vskr72
1 Replies

4. Shell Programming and Scripting

help with email to be triggered based on fatal error detection from batch run log file neded

Hi, I require need help in two aspects actually: 1) Fatal error that gets generated as %F% from a log file say ABClog.dat to trigger a mail. At present I manually grep the log file as <grep %F% ABClog.dat| cut-d "%" -f1>. The idea is to use this same logic to grep the log file which is... (1 Reply)
Discussion started by: zico1986
1 Replies

5. Cybersecurity

How can you send a file over Ip.NOT EMAIL

So I was just wondering... Is there a way to send a file directly to the computer..... Ive never gotten the answer and I want to know how, I keep running in to a wall :wall:. Why you may ask, well really for security reasons due to the fact that if this is done via a port I want to make sure to... (3 Replies)
Discussion started by: orszhak
3 Replies

6. Shell Programming and Scripting

format log file and send in email.

Hi guys i have one script which is as below do some sqlplus output in to $LOG sed '/^$/d' $LOG > /tmp/job.log mv /tmp/job.log $LOG awk '{if ($5=="COMPLETED") {print "backup completed at "$3" "$4 " of " $6 " for " d>> "/home/email.log" } else {print "check backup for " d}}' d="$ORACLE_SID"... (2 Replies)
Discussion started by: tapia
2 Replies

7. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

8. AIX

how to send a file from aix to a email address?

how to send a file from aix to a email address? such as xxx@yahoo.com? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

9. Shell Programming and Scripting

parse the file and send email

Hi Experts, I am writing a script in which i want to parse the file and send the emails to some email-id's. The problem is like this-- I use to get some emails on saturday and sunday's but we do not work on these days. So what i want to do is forward those emails to some email id's. I want... (1 Reply)
Discussion started by: namishtiwari
1 Replies

10. Shell Programming and Scripting

script to send a file in email

a file is created on a daily basis in the name xyz_pqr_20071207.dat.i want to send the file as an attachment if the file contains more than 50 records.how can i write a script such that it will transmit the file after the file is created.i want to sed the file to say asdf@xyz.com. please help me... (2 Replies)
Discussion started by: dr46014
2 Replies
Login or Register to Ask a Question