connect to localhost failed error with Mail::Sendmail on Windows

I

++imanshu

Hi,

I am trying the example script of Mail::Sendmail with ActivePerl
on windows pc connected to the internet:-

---
- trying localhost
- connect to localhost failed (Unknown error)
retrying in 1 seconds...
- connect to localhost failed, next server...
connect to localhost failed (Unknown error)
connect to localhost failed
connect to localhost failed (Unknown error) no (more) retries!
---

This is the script :-

use Mail::Sendmail;

%mail = ( To => '(e-mail address removed)',
From => '(e-mail address removed)',
Message => "This is a very short message",
);

sendmail(%mail) or die $Mail::Sendmail::error;

print "OK. Log says:\n", $Mail::Sendmail::log;

---

What can I set $mail{smtp} so that it works?

Thank You,
++imanshu
 
S

smallpond

Hi,

     I am trying the example script of Mail::Sendmail with ActivePerl
on windows pc connected to the internet:-

---
- trying localhost
- connect to localhost failed (Unknown error)
retrying in 1 seconds...
- connect to localhost failed, next server...
connect to localhost failed (Unknown error)
connect to localhost failed
connect to localhost failed (Unknown error) no (more) retries!
---

     This is the script :-

  use Mail::Sendmail;

  %mail = ( To      => '(e-mail address removed)',
            From    => '(e-mail address removed)',
            Message => "This is a very short message",
          );

  sendmail(%mail) or die $Mail::Sendmail::error;

  print "OK. Log says:\n", $Mail::Sendmail::log;

---

     What can I set $mail{smtp} so that it works?

Thank You,
++imanshu


Installation instructions for Mail::Sendmail:

"At the top of Sendmail.pm, set your default SMTP server(s),
unless you specify it with each message, or want to use the
default (localhost)."

Default is that you are running an smtp mail program listening
on your machine's smtp port. If you don't know what that is
then you don't have one.

Otherwise you need to have a server somewhere else that
supports smtp. Usually, your isp will provide an smtp
server like mail.myisp.net; see their support website.
Some cheap isps now only provide web-based email, in which
case you tell them to go get a new customer.
 
B

Bart Lateur

++imanshu said:
Hi,

I am trying the example script of Mail::Sendmail with ActivePerl
on windows pc connected to the internet:-

I think this module expects sendmail to be running on your computer, or
on a computer in your local network, and with Windows, that's not very
likely.

Why aren't you using SMTP?

If you use MIME::Lite, you can easily switch between the two, which is
handy even if your mails aren't MIME mails.
 
I

++imanshu

Installation instructions for Mail::Sendmail:

"At the top of Sendmail.pm, set your default SMTP server(s),
unless you specify it with each message, or want to use the
default (localhost)."

yes I wrongly assumed smtp to be so simple that the module alone could
handle it without another server. There were some EHLO, HELO strings
in the pm file which reinforced my wrong assumption.
Default is that you are running an smtp mail program listening
on your machine's smtp port.  If you don't know what that is
then you don't have one.

now i understand that i do need one.
Otherwise you need to have a server somewhere else that
supports smtp.  Usually, your isp will provide an smtp
server like mail.myisp.net; see their support website.
Some cheap isps now only provide web-based email, in which
case you tell them to go get a new customer.

My ISP apparently provides relay but under another costlier plan!!

Thank You,
++imanshu
 
U

Uri Guttman

+> My ISP apparently provides relay but under another costlier plan!!

that makes no sense. do they even provide a basic email account? if they
do, they must provide outgoing email service via an smtp
server. relaying is if you need a server on your box and they would
relay it elsewhere (or something similar than typical users would never
need). so find out the name of the outgoing mail server and you can use
it directly with most smtp modules on cpan. you don't need a local
server to send mail if you isp allows you to have a mail account. you
will likely need to provide an account name and password but most of the
modules can handle that too.

uri
 
E

Eric Pozharski

*SKIP*
+> My ISP apparently provides relay but under another costlier plan!!

that makes no sense.

How this? That makes a perfect sense -- think about it from ISP's POV.
The less features to implement the less expensive support (of those
features) is. My previous ISP has gone even farer -- they just
outsourced e-mail altogether (with me supposed to pay for anything more
than webmail).
do they even provide a basic email account?

Why they would? Google fits everyone.

p.s. In fact, I pay for my e-mail; it's not that costly, but I pay.
 
P

Peter J. Holzer

yes I wrongly assumed smtp to be so simple that the module alone could
handle it without another server.

That doesn't make sense. A protocol specifies how two (or more) entities
talk to each other. In the case of a client/server protocol like SMTP,
how a client talks to a server. Since Mail::Sendmail implements an SMTP
client (it is used to send mail, not to receive it), it needs an SMTP
server to talk to.
There were some EHLO, HELO strings
in the pm file which reinforced my wrong assumption.

Of course the module contains these strings. It needs to send them to
the server.

hp
 
S

Steve C

Peter said:
That doesn't make sense. A protocol specifies how two (or more) entities
talk to each other. In the case of a client/server protocol like SMTP,
how a client talks to a server. Since Mail::Sendmail implements an SMTP
client (it is used to send mail, not to receive it), it needs an SMTP
server to talk to.

It makes perfect sense. If you see a module called Sendmail, you think
Hunh. Maybe this module sends mail.
Don't beat up on the guy just for not knowing the guts of mail transport.
It's an easy mistake to make.
 
P

Peter J. Holzer

It makes perfect sense. If you see a module called Sendmail, you think
Hunh. Maybe this module sends mail.

That's what it does. It sends mail. So it's a client. Now you need
something which receives mail. This is called an SMTP server.
Don't beat up on the guy just for not knowing the guts of mail transport.

He knows enough to recognize EHLO as an SMTP keyword.

hp
 
I

++imanshu

Quoth "Peter J. Holzer" <[email protected]>:





It's not a priori obvious that Mail::Sendmail can't (and shouldn't)
perform MX lookups and deliver the mail directly to the appropriate
mailhost. OTOH, I would say anyone who *doesn't* know this (and why)
should not be writing programs which send mail...

Ben

Thanks for the replies. The beating is well deserved :D

I understand that I need to go back to the books for this.

Thank You,
++imanshu
 
P

Peter J. Holzer

I could answer that in that case it still needs a server, it just
determines the server from the recipient domain via DNS instead of from
local configuration. But that would be nitpicking.

Mail::Sendmail should be able to talk to an MX if you can configure that
locally (which might make sense if you just want to send mail to a fixed
address), but in general this isn't useful. It wants a local submission
server which can then handle all the hard parts of mail transport,
especially queueing and retries after temporary failures.
Thanks for the replies. The beating is well deserved :D

It wasn't meant as a beating. I was just puzzled how somebody who
obviously knows enough about SMTP to recognize SMTP keywords could fail
to recognize that Mail::Sendmail implements an SMTP client (or, more
specifically, a SUBMISSION client) and therefore needs an SMTP server to
talk to.

hp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top