Hey,

I'm trying to send mail over my server (1and1.com). They require smtp 
authentication in order to send. I'm using windows XP.

Here is my code:

#!/usr/bin/perl -w

use strict;
use Net::SMTP;

my $mail_server = "mailhost";
my $username = "login";
my $password = "password";
my $msg = "This is a test";

my $smtp = Net::SMTP->new($mail_server, Hello => 'mailhost', Port => 587, 
Timeout => 60, Debug => 1)
    or die "Can't open connection to $mail_server:$!\n";
defined ($smtp->auth($username, $password))
    or die "Can't authenticate: $!\n";

$smtp->auth($username, $password);
$smtp->mail('sender');
$smtp->recipient('recipient');
$smtp->to('recipient');

$smtp->data();
$smtp->datasend($msg);
$smtp->dataend();
$smtp->quit;

exit;



                
---------------------------------
 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.

Reply via email to