LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-07-2004, 12:52 PM   #1
anjaan
LQ Newbie
 
Registered: Aug 2003
Posts: 19

Rep: Reputation: 0
Email headers in shell script


Hi all,

I am trying to write a script that will send email to me every few hours. But I need to customize subject and headers. How will I do this in a bash script.

If someone can tell me how to wait for few seconds and then run the next line in the script that will be useful too.

Thanks in advance

Last edited by anjaan; 07-07-2004 at 01:08 PM.
 
Old 07-07-2004, 01:14 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
You do not tell what program you are using to mail, so I'll use mailx for the example.
Something like this works:

mailx -s "$subject" $maillist

Waiting (sleeping) for a certain amount of thime:

sleep <secs>, where secs is amount of seconds to sleep. If you sleep for long times at once, there wil be a deviation.
 
Old 07-07-2004, 01:19 PM   #3
anjaan
LQ Newbie
 
Registered: Aug 2003
Posts: 19

Original Poster
Rep: Reputation: 0
I am using Sendmail. Actually, I need something that will create an interactive telnet session

telnet 127.0.0.1 25
helo domain.com
etc
etc
 
Old 07-07-2004, 01:30 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Maybe a 'here document' construct could do what you want.

This site has some examples of how it works:
http://www.tldp.org/LDP/abs/html/here-docs.html

I'm not a telnet user (to insecure for my taste), so I'm not sure if the login in part can be done this way.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Grep Syslog - email shell script voodoofxz Linux - Newbie 1 09-06-2005 04:27 PM
python cgi script and premature end of script headers Neruocomp Programming 1 07-28-2005 11:43 AM
write a shell script to send email yenonn Programming 4 02-11-2005 10:06 PM
Shell script, validating email and website Joey^s Programming 5 12-04-2004 05:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration