using sendmail in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using sendmail in ksh
# 1  
Old 01-22-2007
using sendmail in ksh

Anyone have any experience with sendmail?

I'm creating messages with the to, from, subject, body etc. in a temp directory and then want to send all of the messages after they are created using the sendmail -t command
An example message:
Subject: DDTS Reminder
From: campbelr
To: campbelr,robert.e.campbell@baesystems.com
These defects have been in New longer than 2 days.
DTFnl31127 Tracking DR for LSS CSIL Migration

DTFnl31128 Tracking DR for CSIL Migration


i'm able to send one message using this command:
cat temp/message1 | sendmail -t

but when i tried this:
cat temp/* | sendmail -t

it concatenated all the messages into one and then sent it. How can I send each message individually?
# 2  
Old 01-22-2007
ls temp/* | \
while read FILE
do
cat $FILE | sendmail -t
done
# 3  
Old 01-22-2007
or without the UUOC and UUOL

Code:
for file in /temp/*; do
   sendmail -t < $file
done

# 4  
Old 01-23-2007
Or:

Code:
eval "$(printf "sendmail -t < %s;" /temp/*)"


Last edited by radoulov; 01-23-2007 at 05:50 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending mail with attachment(image) using sendmail in Linux(ksh)

Hi guys, I am trying to send a mail with below command which is working fine. $FilePath_mail have To,From and other information along with mail body which is in HTML format. I want to have image(logo) in the body. So just wanted to send it as an an attachment. /usr/sbin/sendmail -t <... (1 Reply)
Discussion started by: balakrishnaps
1 Replies

2. Red Hat

Need help on sendmail

my requirement is user should be able put username@particular domain in from address, if he is adding anything in from address,it should not allow to send the mail. there should be restriction on from address. (2 Replies)
Discussion started by: manoj.solaris
2 Replies

3. Solaris

Clarifying sendmail configuration - sendmail-client offline

Hi all, I have read about sendmail running as 2 separate process. 1 as a MSP, and the other as the real daemon or MTA. In my current configuration, the sendmail-client is disabled. Both submit.cf and sendmail.cf are left as default untouch I do not specified any mailhost... (3 Replies)
Discussion started by: javanoob
3 Replies

4. UNIX for Advanced & Expert Users

Sendmail questions, SCO 5.0.6 sendmail 8.11.0

I am running SCO 5.0.6 and using sendmail 8.11.0 and having issues with smtp authentication. When trying to send mail the following message will kick back. (reason: 530 5.7.1 Authentication required) 530 5.7.1 Authentication required Not sure what needs to be tweeked in sendmail.cf but I... (1 Reply)
Discussion started by: ziggy6
1 Replies

5. Shell Programming and Scripting

different behaviour for ksh and ksh -x

I'm getting different behaviour when executing below script in debug option. $ cat ss.ksh ff=$(pwd) echo " ff : $ff" $ ksh ss.ksh ff : /tmp $ ksh -x ss.ksh + + pwd ff= + echo ff : ff : I was getting this behaviour in my actuall script i'm able to reproduce this in simple script... (4 Replies)
Discussion started by: luckybalaji
4 Replies

6. UNIX for Dummies Questions & Answers

Difference Between executing llike ./myscript.ksh and . ./myscript.ksh

Hi , What is the diffence between executing the script like ./myscript.ksh . ./myscript.ksh I have found 2 difference but could not find the reason 1. If i export a variable in myscript.ksh and execute it like . ./myscript.ksh the i can access the other scripts that are present in... (5 Replies)
Discussion started by: max_hammer
5 Replies

7. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

8. Red Hat

sendmail help

Dear All how the root user i.e root@localhos.localdomain can be masqueraded in sendmail i want to masquerade the above to say test@test.com Regards and thanks in advance (3 Replies)
Discussion started by: surfer24
3 Replies

9. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies

10. Shell Programming and Scripting

Sendmail via KSH.

Hi to all! I have the necessity to handle errors in my ksh script sending errors via e-mail. Do you have any idea about this? More exactly I wish optimize this situation using an external distribution list of all internet address mail. Many thanks in advance for your kind cooperation. ... (1 Reply)
Discussion started by: gio123bg
1 Replies
Login or Register to Ask a Question