Hi, How would someone find out the mailserver in the line below:
my $smtp= Net::SMTP->new('mailserver'); thanks, William --------------------------------------- >From: Timothy Johnson <[EMAIL PROTECTED]> >To: "'William Black'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >CC: [EMAIL PROTECTED], [EMAIL PROTECTED] >Subject: RE: Few More Questions >Date: Mon, 8 Jul 2002 10:01:16 -0700 > > >That line tells the server who is sending the email. This will show up in >the From: field of the message when it is received. I think you're a >little >mixed up about hashes, though. If you want to create an array of hashes, >you should change > > @contact[0]=(name=>'John Doe',email=>[EMAIL PROTECTED],); > @contact[1]=(name=>'Anita coffin',email=>[EMAIL PROTECTED]); > >to > > $contact[0] = {name => 'John Doe',email => '[EMAIL PROTECTED]'}; > $contact[1] = {name => 'Anita Coffin',email => '[EMAIL PROTECTED]'}; > #note the curly brackets and the $ in front of the variable > >then you could access them like so: > > $contact[0]->{name} #access indirectly > >or > > ${$contact[0]}{name}#dereference the hash first > >You should check out the recent thread called Quick Question, later renamed >to How to Send an Automatic Mail Alert. Your script might look a little >snappier if you use a HERE doc instead of all those concatenations. > > > >-----Original Message----- >From: William Black [mailto:[EMAIL PROTECTED]] >Sent: Monday, July 08, 2002 9:45 AM >To: [EMAIL PROTECTED] >Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] >Subject: RE: Few More Questions > > >Can you do something like this, And if you can what does the >$smtp->mail('[EMAIL PROTECTED]') line represent. > >use Net::SMTP; >use strict; > >@contact[0]=(name=>'John Doe',email=>[EMAIL PROTECTED],); >@contact[1]=(name=>'Anita coffin',email=>[EMAIL PROTECTED]); > >my data ''; >data .="To: Primary Contact"; >data .="Subject Automated Alert; >data .="\n"; >data .="Hello @contact[0]{name},@contact[1]{name}, \n"; >data .="This is an automated alert to let you know that\n"; >data .="An error has occoured in the specified file\n"; >data .="Please address the problem immediatly\n"; > >my $smtp= Net::SMTP->new('mailserver'); >$smtp->mail('[EMAIL PROTECTED]'); >$smtp->(@contact[0]{email},@contact[1]{email}); >$smtp->data([$data]) >$smtp->quit; > >thanks, > >William > > >From: Nikola Janceski <[EMAIL PROTECTED]> > >To: Nikola Janceski <[EMAIL PROTECTED]>, 'William Black' > ><[EMAIL PROTECTED]>, [EMAIL PROTECTED] > >Subject: RE: Few Questions > >Date: Mon, 8 Jul 2002 12:20:31 -0400 > > > >OOOPPSSS... I forgot the $ > >see below > > > > > > > -----Original Message----- > > > From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > > > Sent: Monday, July 08, 2002 12:17 PM > > > To: 'William Black'; [EMAIL PROTECTED] > > > Subject: RE: Few Questions > > > > > > > > > See in-line reply below > > > > > > > -----Original Message----- > > > > From: William Black [mailto:[EMAIL PROTECTED]] > > > > Sent: Monday, July 08, 2002 12:04 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: RE: Few Questions > > > > > > > > > > > > > > > > Hi all, > > > > > > > > I have a few short questions: > > > > > > > > First, How do you make an array of hashes and access them > > > > once you have > > > > created them. > > > > > > This is a little difficult for a beginner but I will give you > > > the basic > > > basics: > > > you have an array @a > > > now you want to have @a[0] have a hash of values: > > > @a[0] = ( key1 => value1, > > > key2 => value2 ); > > > > > > to get key1's value: @a[0]{key1} > > > >should be $$a[0]{key1} > > > > > now another way to add to it. > > > > > > foreach my $key ( qw(key1 key2) ){ > > > @a[1]{$key} = 100; > >should be $$a[1]{$key} > > > > > } > > > > > > print "@a[1]{key2}\n"; ## will print 100; > > > print "@a[0]{key2}\n"; ## will print value2; > > > >you get the idea of my mistakes. > > > > > > > > get it? > > > > > > > > > > > Next,How would email someone from within a perl pgm. I want > > > > to email more > > > > than one person at the same time. The script is running on a > > > > unix box, but > > > > the people receiving the emails can be on a differentOS(i.e > > > > windows NT, > > > > ETC). > > > > > > use any of the following modules: > > > Net::SMTP > > > Mail::Sender > > > MIME::Entity > > > > > > and for the TO or CC just separate the various e-mail with a > > > comma (,): > > > [EMAIL PROTECTED], [EMAIL PROTECTED] > > > > > > or > > > > > > Got Jack <[EMAIL PROTECTED]>, Bill GotNone <[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > William Black > > > > > > > > > > > > > > > > _________________________________________________________________ > > > > Join the world's largest e-mail service with MSN Hotmail. > > > > http://www.hotmail.com > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -------------------------------------------------------------- > > > -------------- > > > -------------------- > > > The views and opinions expressed in this email message are > > > the sender's > > > own, and do not necessarily represent the views and opinions of Summit > > > Systems Inc. > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > >--------------------------------------------------------------------------- >- > >-------------------- > >The views and opinions expressed in this email message are the sender's > >own, and do not necessarily represent the views and opinions of Summit > >Systems Inc. > > > > > >-- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > >William Black > > > >_________________________________________________________________ >MSN Photos is the easiest way to share and print your photos: >http://photos.msn.com/support/worldwide.aspx > > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > William Black _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]