Thanks Deborah,
That's works fine on my local smtp relay server. But.. how can I get the script to check the server response after issuing the $smtp->to $var ? I want to trap any rejections by the server. Meantime I'll see if I can find documents on Net::SMTP Thanks again, Walter From: Deborah Martin [mailto:[email protected]] Sent: 31 March 2010 14:47 To: 'walt' Subject: RE: Connecting to a socket Importance: High Walter, You could adapt the following program :- #!/usr/bin/perl # Simple email program use Net::SMTP; my $from = 'yourf...@address'; my $site = 'yoursitename'; my $smtp_host = 'yourmailhost'; my $to = 'you...@address'; my $smtp = Net::SMTP->new($smtp_host, Hello => $site); $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("Subject: A message from a Perl program\n"); $smtp->datasend("\n"); $smtp->datasend("This is a test message from a Perl program\n"); $smtp->dataend(); $smtp->quit; Regards, Deborah -----Original Message----- From: walt [mailto:[email protected]] Sent: 31 March 2010 14:39 To: [email protected] Subject: Connecting to a socket Hi, I am new to Perl and want to connect to an smtp server on port 25 and then send it the helo, mail from:, rcpt to:, data, commands but I would also like to evaluate the response from the smtp server. Has anyone got a script or can point me in the right direction? I know I could use mailman or sendmail but I want to learn how to format emails on the fly and evaluate the server response which I can't do using a relay server. Many thanks, Walter -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/ *************************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorised distribution or copying is strictly prohibited. Whilst Kognitio Limited takes steps to prevent the transmission of viruses via e-mail, we can not guarantee that any email or attachment is free from computer viruses and you are strongly advised to undertake your own anti-virus precautions. Kognitio grants no warranties regarding performance, use or quality of any e-mail or attachment and undertakes no liability for loss or damage, howsoever caused. Kognitio Limited, a company registered in England and Wales. Registered number 0212 7833. Registered Office: 3a Waterside Park, Cookham Road, Bracknell, Berks, RG12 1RB. VAT number 864 4378 92. Kognitio Inc, a company incorporated in Delaware, principal office 180 North Stetson, Suite 3500, Chicago, IL 60601, USA ***************************************************************************
