hello sir
i m searching from 25 days a simple perl script to send mail in perl,..
i tried many mail server as yahoo,gmail,rediff,hotmail and so many,but i couldn't got success,
so any body can tell me any mail server by that i can send mail in perl,my perl script is right but i don't have any smtp server that can be used to send mail in perl,
i want to send mail my self,but i don't know any smtp server,
i m ready to make account on that mail server what i will use to send mail....
plz plz plz plz plz sir help meee plz i m on windows xp sp2..
here is my code***
Code:
use Net::SMTP;
use MIME::Base64;
$message="From: ".'senderdomain.com'."\nTo: ".'reciever@domain.com'."\n"."Subject: Hello\n\nTest\n\n";
print $message;
print "\n";
my $DEBUG = 1;
my $ServerName = 'my mail server';
my $ServerAccount = encode_base64('XXXXX');
my $ServerPwd = encode_base64('XXXXX');
my $MailFrom = '$sender';
my $MailTo = '$reciever';
print "Server variables assigned\n";
my $smtp = Net::SMTP->new($ServerName, Hello => "domain.com", Debug => 1);
die "Couldn't connect to server" unless $smtp;
print "Server connection opened\n";
if ( !$smtp->auth($ServerAccount, $ServerPwd) ) {
print "authentication failed or not needed\n";
}
if ( !$smtp->mail( $MailFrom ) ) {
print "sender not accepted\n";
exit 1;
}
if (!$smtp->to( $MailTo ) ) {
print "addressee not accepted\n";
exit 1;
}
print "Server variables checked\n";
my $maildata = $message;
$smtp->data();
$smtp->datasend( $maildata );
$smtp->dataend();
$smtp->quit();
$smtp->quit;
print "Finished sending email\n";
**************************
plz help sir plz sir plz
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.