Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

MIME::Lite send_by_smtp cant change the default port
Hi ALL,

I am trying to send a mail using MIME::Lite
I am trying to connect to port 26 of smtp server instead of 25 , but no
luck
I am not able to see anything wrong in this script , I hope I could get
some inputs

Thanks
Ram

------------------ My script is here
#!/usr/bin/perl
use strict;
use MIME::Lite;

my $str= <<EOHTML;
This is a test mail
Please ignore
EOHTML
my  $msg = MIME::Lite->new(
To      => $ARGV[0],
From    => $ARGV[1],
Subject => 'Test Mail',
Type    => 'multipart/related'
);

$msg->attach( Type => 'text/plain', Data => $str );
$msg->send_by_smtp("192.168.2.65",Port=>26);


-----------------------
This is the output I get

Failed to connect to mail server: Bad file descriptor
at perl/smtp26 line 17





----------------------------------------------------------
Netcore Solutions Pvt. Ltd.
Website:  http://www.netcore.co.in
Spamtraps: http://cleanmail.netcore.co.in/directory.html
----------------------------------------------------------

Report this thread to moderator Post Follow-up to this message
Old Post
Ramprasad A Padmanabhan
06-03-05 08:56 PM


Re: MIME::Lite send_by_smtp cant change the default port
On Fri, 03 Jun 2005 15:55:10 +0530, rampra@netcore.co.in (Rampra A
Padmanabhan) wrote:

>Hi ALL,
>
>  I am trying to send a mail using MIME::Lite
> I am trying to connect to port 26 of smtp server instead of 25 , but no
>luck
>I am not able to see anything wrong in this script , I hope I could get
>some inputs

>------------------ My script is here
>#!/usr/bin/perl
>use strict;
>use MIME::Lite;
>
>my $str= <<EOHTML;
>This is a test mail
>Please ignore
>EOHTML
>my  $msg = MIME::Lite->new(
>                        To      => $ARGV[0],
>                        From    => $ARGV[1],
>                        Subject => 'Test Mail',
>                       Type    => 'multipart/related'
>                        );
>
>$msg->attach( Type => 'text/plain', Data => $str );
>$msg->send_by_smtp("192.168.2.65",Port=>26);
>
>
>-----------------------
>This is the output I get
>
>Failed to connect to mail server: Bad file descriptor
>at perl/smtp26 line 17

I have this example working, using MIME::Lite and Net::SMTP,
but it dosn't use MIME::Lite's send_by_smtp; it uses Net::SMTP
to do the sending, and gets the $msg->as_string from MIME::Lite.

Also make sure there is something listening on port 26.  Usually when
the server is on a non-standard port, you need auth too. So you may
need the Net::SMTP_auth module.

#!/usr/bin/perl
use warnings;
use strict;
use MIME::Lite;
use Net::SMTP;

my $Servername = "mail.foobar.net";
my $Port = 26;

my $msg = MIME::Lite->new(
From  => 'me@foobar.net',
TO    => 'you@feefifo.net',
Subject  => 'Testing Text Message  ',
Data     => 'How's it going. Sent with  Net-SMTP and MIME::Lite'
);

#get MIME::Lite's message
#my $msgbody = $msg->as_string();

my $smtp = Net::SMTP->new($Servername, Port=>$Port );

$smtp->mail('me@foobar.net');
$smtp->to('you@feefifo.net');
$smtp -> data();
$smtp -> datasend( $msg->as_string() );
$smtp -> dataend();
$smtp -> quit;
__END__












--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

Report this thread to moderator Post Follow-up to this message
Old Post
Zentara
06-04-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:41 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.