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
email addresses okbrowder UNIX and Linux Applications 0 04-20-2008 12:02 PM
keeps telling me my email addresses don't match r0k3t Forum Support Area for Unregistered Users & Account Problems 0 01-22-2007 06:13 AM
How to delete old email addresses? Deede UNIX for Dummies Questions & Answers 1 02-03-2004 12:25 PM
How to delete email addresses Deede High Level Programming 4 02-02-2004 03:23 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-29-2008
Registered User
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 174
Stumble this Post!
Email Question - two email addresses

Hello,
I have an email script that runs when a process is complete. I would like to have the email sent to two different email addresses, but it is only sending it to the first one. Can you take a look and see what I need to correct? I thought if I surrounded them with double quotes and separated them with a comma that would work. I don't have sendmail configured so I use telnet. This is an AIX 5.2 system Thank you.
Code:
#!/usr/bin/ksh
MAILADDRTO="first@someplace.com,second@someplace.com"
MAILADDRFR=email@mail.com
(sleep 5
echo EHLO
sleep 5
echo MAIL FROM: $MAILADDRFR
sleep 5
echo RCPT TO: $MAILADDRTO
sleep 5
echo DATA
sleep 5
echo From: $MAILADDRFR
echo To: $MAILADDRTO
echo subject: PBS Check File Created
echo
echo The PBS check file is available for download
echo
sleep 5
echo .
sleep 5
echo QUIT
sleep 5) | telnet 00.00.00.00 25
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-29-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 709
Stumble this Post!
Post

According to google you need to use multiple RCPT lines:
Code:
...
for rcpt in `echo $MAILADDRTO | sed 's/,/ /g'`
do
  echo RCPT TO: $rcpt
  sleep 5
done
...
Reply With Quote
  #3 (permalink)  
Old 05-30-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
Scripting a raw telnet to port 25 is monstrously misdirected, though. See if you can install a minimal SMTP client such as Perl with Net::SMTP instead.
Reply With Quote
  #4 (permalink)  
Old 05-30-2008
Registered User
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 174
Stumble this Post!
Thank you Smiling Dragon for the response. Era, yes you are right. Just laziness on my part.
Reply With Quote
  #5 (permalink)  
Old 08-04-2008
psiva_arul's Avatar
Registered User
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 78
Stumble this Post!
You can use like this

MAILADDRTO="first@someplace.com\,second@someplace.com\"

it could be works...


Regards,
MPS
Reply With Quote
  #6 (permalink)  
Old 08-04-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
It would work like that if you were using regular Sendmail, but this script attempts to speak raw SMTP, which at least per the spec does require a separate RCPT TO: for each recipient address.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:53 AM.


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

Content Relevant URLs by vBSEO 3.2.0