|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Send a mail to IDs listed in a text file
I have a list of mail ids in text file and want a ksh script that reads this text file and sends a mail to all mail ids with same subject line and content.
I am using UX-HP machine and KSH. Thanks for help in advance! |
| Sponsored Links | |
|
|
|
#2
|
|||
|
|||
|
what is the format of the text file?
are the Ids on each line? csv? |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
txt file can be anything, I just have a list of mail IDs. not sure what format of file to put these mail IDs. but list may grow in future. so, option should be there to add mail IDs later to the file.
|
|
#4
|
|||
|
|||
|
from the format i was trying to ask that you file contains the IDs like, Code:
abc.123@domain.com,abc.123@domain.com,abc.123@domain.com or abc.123@domain.com abc.123@domain.com abc.123@domain.com or abc.123@domain.com|abc.123@domain.com|abc.123@domain.com or even simply, abc.123@domain.com abc.123@domain.com abc.123@domain.com try respectively, Code:
echo 'this is content' | mailx -s 'subject' $(cat file | tr ',' ' ') or echo 'this is content' | mailx -s 'subject' $(cat file | tr '\n' ' ') or echo 'this is content' | mailx -s 'subject' $(cat file | tr '|' ' ') or echo 'this is content' | mailx -s 'subject' $(cat file) Last edited by anchal_khare; 03-11-2010 at 04:32 AM.. Reason: added solution |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
I have a text file mail_list.txt where mail ids are list one below the other
Ex: abbc@xyz.com zxcv@xyz.com sdfg@xyz.com |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Code:
#!/bin/ksh
sendm()
{
sendto="$1"
/usr/lib/sendmail -t -i <<EOF
Subject: some
From: some
To: $sendto
Maildata
EOF
}
##### main #####
cat somefile | while read addr
do
sendm "$addr"
doneMore sendmail examples. |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Send mail with rich text / HTML with image | rythym05 | Shell Programming and Scripting | 2 | 12-20-2009 01:52 PM |
| Shellscript to sort duplicate files listed in a text file | deaddevil | Shell Programming and Scripting | 11 | 11-02-2009 04:54 AM |
| Copy files listed in a text file - whitespace problem. | 60doses | Shell Programming and Scripting | 4 | 10-20-2008 07:14 PM |
| Send an attachment and html text both in the same mail | stefan.yu | Shell Programming and Scripting | 4 | 10-26-2006 09:46 PM |
| Send text file to mail | petrosi | UNIX for Dummies Questions & Answers | 2 | 02-20-2001 09:56 PM |
|
|