> > Hi Dan Howdy - Post back to the list so everyone can share.
> > ok, i changed it to > smtp.cctv.dundee.ac.uk > > but still, > [EMAIL PROTECTED] cgi-bin]# perl emailtest.pl > Content-type: text/plain > > Couldn't connect to server at emailtest.pl line 23. > [EMAIL PROTECTED] cgi-bin]# > > does the email from has to be from the server? if so then how Depends how smtp is set up at smtp.cctv.dundee.ac.uk Does that allow smtp connections from the ip address the script is at? > do i create > this, i dont have an email server on my server. i basically > installed red > hat 8. Another thing. It may be dns :: If I do a ping :: # ping smtp.cctv.dundee.ac.uk ping: cannot resolve smtp.cctv.dundee.ac.uk: Unknown host # Try the ip address of the server instead of the domain or a resolvable domain at least. If you specify/can resolve the domain to it's ip and the smtp server will allow smtp connections from your ip address then you're all set. It's not really a perl issue but an smtp server/dns issue. Hope that helps DMuey > > Regards, > > Mel > > > > > > >From: "Dan Muey" <[EMAIL PROTECTED]> > >To: "mel awaisi" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > >Subject: RE: script to send email message > >Date: Tue, 25 Mar 2003 14:35:51 -0600 > > > > > > > Hi, > > > > > > I have been researching on this. i got a script when i try to run > > > get an error connecting to server. This script i am just trying to > > > get to work, but > > > the main reason for this is to be able to insert it into > > > another Perl script > > > where i would like email to be sent automatically when the > > > other part of the > > > script does something! > > > > > > [EMAIL PROTECTED] cgi-bin]# perl email.pl > > > Content-type: text/plain > > > > > > Couldn't connect to server at email.pl line 22. > > > [EMAIL PROTECTED] cgi-bin]# > > > > > > > > > Regards, > > > > > > Mel > > > > > > ---------------------email.pl > > > > > > #!/usr/local/bin/perl > > > > > > use Net::SMTP; > > > > > > print "Content-type: text/plain", "\n\n"; > > > > > > my $DEBUG = 1; > > > > > > if($DEBUG) > > > { > > > $| = 1; > > > open(STDERR, ">&STDOUT"); > > > } > > > > > > # Set this variable to your smtp server name > > > my $ServerName = "smtp.134.36.16.12"; > > > >Uh, IP address or name can't mix em. I'd make this 134.36.16.12 > >Or > >smtp.whateverthedomainisforthatip.com > > > >I'll bet tha'd clear it right up > > > >DMuey > > > > > > > > # Create a new SMTP object > > > $smtp = Net::SMTP->new($ServerName, Debug => 1); > > > > > > # If you can't connect, don't proceed with the rest of the script > > > die "Couldn't connect to server" unless $smtp; > > > > > > # Initiate the mail transaction > > > # Your "real" email address > > > my $MailFrom = "[EMAIL PROTECTED]"; > > > > > > # Recipient's "real" email address > > > my $MailTo = "[EMAIL PROTECTED]"; > > > > > > $smtp->mail( $MailFrom ); > > > $smtp->to( $MailTo ); > > > > > > # Start the mail > > > $smtp->data(); > > > > > > # Send the header > > > # This address will appear in the message > > > $smtp->datasend("To: [EMAIL PROTECTED]"); > > > > > > # So will this one > > > $smtp->datasend("From: [EMAIL PROTECTED]"); > > > $smtp->datasend("Subject: Test Message\n"); $smtp->datasend("\n"); > > > > > > # Send the body. > > > $smtp->datasend("Hello World!\n\n"); > > > > > > # Send the termination string > > > $smtp->dataend(); > > > > > > # Close the connection > > > $smtp->quit(); > > > > > > > > > _________________________________________________________________ > > > On the move? Get Hotmail on your mobile phone > > > http://www.msn.co.uk/msnmobile/mobilehotmail > > > > > > > > > -- > > > 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] > > > > > _________________________________________________________________ > It's fast, it's easy and it's free. Get MSN Messenger today! > http://www.msn.co.uk/messenger > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]