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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-29-2008
jyoung jyoung is offline
Registered User
  
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 228
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
  #2 (permalink)  
Old 05-29-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
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
...
  #3 (permalink)  
Old 05-30-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.
  #4 (permalink)  
Old 05-30-2008
jyoung jyoung is offline
Registered User
  
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 228
Thank you Smiling Dragon for the response. Era, yes you are right. Just laziness on my part.
  #5 (permalink)  
Old 08-04-2008
psiva_arul's Avatar
psiva_arul psiva_arul is offline
Registered User
  
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 97
You can use like this

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

it could be works...


Regards,
MPS
  #6 (permalink)  
Old 08-04-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.
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 12:56 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