Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Send email without using SMTP server

by madtoperl (Hermit)
on Nov 13, 2008 at 10:46 UTC ( #723407=perlquestion: print w/replies, xml ) Need Help??

madtoperl has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,
I need to send an email with xls file as attachment using perl. when I ran this below code,I got the following error
Connection error from localhost on port 25 ()
While googled this issue, it seems the SMTP server port is blocked. Could you please let me know how can I solve this issue.
The code is given below,
use Mail::Sendmail; %mail = ( To => '', From => '', Message => "This is a very short message" ); sendmail(%mail) or die $Mail::Sendmail::error; print "OK. Log says:\n", $Mail::Sendmail::log;

Replies are listed 'Best First'.
Re: Send email without using SMTP server
by fmerges (Chaplain) on Nov 13, 2008 at 12:18 UTC


    Your problems look more like you don't have installed any MTA on your system, do you?

    Read the docs of the module, you can provide the option of the SMTP server you gonna use like:

    my %mail = ( To => '', From => '', Message => "This is a very short message", smtp => '', );

    Another module I could recommend is Mail::Mailer.


    fmerges at
Re: Send email without using SMTP server
by jettero (Monsignor) on Nov 13, 2008 at 11:34 UTC
    You'll probably end up using MIME::Lite with the Net::SMTP option (see change how messages are sent).


    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://723407]
Approved by prasadbabu
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2023-12-10 08:27 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (39 votes). Check out past polls.