The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 03:27 AM
Using Mailx to send to list of email addresses aguad3 UNIX Desktop for Dummies Questions & Answers 1 03-28-2008 03:40 PM
to send email to multiple users vishwas.shenoy UNIX for Dummies Questions & Answers 0 01-25-2008 06:00 AM
How to send attachment to web-based email client using mailx randomcz1 Shell Programming and Scripting 1 11-07-2006 05: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 10:43 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-19-2006
priyaksingh priyaksingh is offline
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.
  #2 (permalink)  
Old 02-19-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

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

How to send mail to multiple users ???
  #3 (permalink)  
Old 02-20-2006
priyaksingh priyaksingh is offline
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.
  #4 (permalink)  
Old 02-20-2006
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,407
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=".
  #5 (permalink)  
Old 02-21-2006
Manish Jha Manish Jha is offline
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0