Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Send email without using SMTP server

by madtoperl (Hermit)
on Nov 13, 2008 at 10:46 UTC ( [id://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 => 'tom@xyz.com', From => 'jerry@xyz.com', 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

    Hi,

    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 => 'tom@xyz.com', From => 'jerry@xyz.com', Message => "This is a very short message", smtp => 'smtp.xyz.com', );

    Another module I could recommend is Mail::Mailer.

    Regards,

    fmerges at irc.freenode.net
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).

    -Paul

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-24 01:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found