The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Not able to send email as CC to a ID using Mailx command in HP UX rohit.shetty84 UNIX for Dummies Questions & Answers 1 05-14-2008 12:27 AM
Using Mailx to send to list of email addresses aguad3 UNIX Desktop for Dummies Questions & Answers 1 03-28-2008 12:40 PM
to send email to multiple users vishwas.shenoy UNIX for Dummies Questions & Answers 0 01-25-2008 03:00 AM
How to send attachment to web-based email client using mailx randomcz1 Shell Programming and Scripting 1 11-07-2006 02:00 PM
Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win) Vetrivela UNIX for Advanced & Expert Users 2 02-15-2005 07:43 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-18-2006
Registered User
 

Join Date: Feb 2006
Posts: 2
Using mailx to send email to multiple users.

Hi,

I am using the mailx command to send email to multple users. The command works fine when i am sending mail to a single user but when i insert multiple email ids inside the quote it does not work. All the email ids are coming from a property file.Please have a lookt at the property file and the script below below.

xyz.ini
MAILLIST='priyaksingh@rediffmail.com,reahksingh@yahoo.co.in'

script
EMAIL=`grep "MAILLISt=" /xyz.ini | cut -f2 -d=`; export EMAIL
....
....
....

mailx -s "Hi" ${EMAIL} <<! Hi
!


Please do let me know about the exact command that will send email to multiple users.
Reply With Quote
Forum Sponsor
  #2  
Old 02-19-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,698
Try using the forum search feature.

How to send mail to multiple users ???
Reply With Quote
  #3  
Old 02-20-2006
Registered User
 

Join Date: Feb 2006
Posts: 2
Thank You Vino. the solution works fine untill the same email ids are assigned to a variable and this list is coming from a property file.


My Property File.
List="receip@xyz.com, receip2@xyz.com"

My Script
MailList=`grep "List=" /propertyfile.ini | cut -f1 -d"+"`
export MailList
mailx -s "Hi" $MailList < text.msg

The above code fails. help me out its urgent.
Reply With Quote
  #4  
Old 02-20-2006
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
The problem is how you define the $Maillist variable. Try running with set -x if using ksh.

Perhaps you could post your real code here. Your "properties" file is either called xyz.ini
or propertyfile.ini and either begins with "List=" or "MAILLIST=".
Reply With Quote
  #5  
Old 02-20-2006
Registered User
 

Join Date: Dec 2005
Location: Boston, USA
Posts: 65
Hey Priya,
Simply I see only problem to this and that is "," in your mail list. Try to remove comma from mail list and separate the email ids by space and hope you should be all set.

Other wise you could just use sendmail command with "," separated email ids.
Syntax for the sendmail.


LOGNAME=`whoami` #If mail couldnot be send, it will bounce on this account
MailList=${Mail_File_Path}/Mail_List.txt
MAILTO=`cat $ MailList `
echo "From: $LOGNAME\nTo: $MAILTO\nSubject: $SUBJECT" > $mail_body_file

echo "
$SUBJECT.

Regards,
$LOGNAME" >> $mail_body_file
echo ".\n" >> $mail_body_file
#Mail will not be sent to anyone if "." does not appear in first column of th



/usr/lib/sendmail -t -oi < $mail_body_file


Don’t forget to add . at the last like I used here with echo. It is mandatory.
Here you can use To,CC,BC, subject attachement ect. Its almost identical to outlook mail so you can use all the facilities what ever you can see in your outlook on windows.

Regards,
Manish Jha
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0