How would you mail yourself from XP

Z

zoo

I use this piece of code to mail myself but my operating system can't find
the mail command.
How would I make this command work with windows XP ?

open MAIL, "|mail zoo@/hotmail.com";
print MAIL "bad $somename guessed $someguess\n";
close MAIL;


'mail' is not recognized as an internal or external command,
operable program or batch file.

J.
 
A

A. Sinan Unur

zoo said:
I use this piece of code to mail myself but my operating system can't
find the mail command. How would I make this command work with
windows XP ?

open MAIL, "|mail zoo@/hotmail.com";
print MAIL "bad $somename guessed $someguess\n";
close MAIL;


'mail' is not recognized as an internal or external command,
operable program or batch file.

BLAT might help: http://www.interlog.com/~tcharron/blat.html
 
A

A. Sinan Unur

zoo said:
Since I am trying to learn Perl and XP is a prevalent operating system
I figured there would be someone who would know the answer to this
question. its not entirely unrelated.

Could anyone be willing to help with this question. ?

First off, please do not top post. Second, your question is at best a CGI
question and at worst a question about where to find a specific tool for
a specific operating system, and as such not related to Perl. The fact
that you are piping Perl's output to a utility does not make the utility
relevant to Perl.

In any case, see my other post in this thread for a link to a utility
that might be of some help.

Sinan.
 
W

William Alexander Segraves

zoo said:
I use this piece of code to mail myself but my operating system can't find
the mail command.
How would I make this command work with windows XP ?

You can't. WNU (Win's Not Unix) doesn't have a mail command, as you
discovered. Of course, you could (possibly someday) write your own mail
client, but ... Why reinvent the wheel?
open MAIL, "|mail zoo@/hotmail.com";
print MAIL "bad $somename guessed $someguess\n";
close MAIL;


'mail' is not recognized as an internal or external command,
operable program or batch file.

Hmm. You appear to be stuck on page 21 of _Learning Perl, 2nd edition_. Did
you by any chance note (see cover) that LP2e is for UNIX Programming?

Others have told you your problem is not a Perl problem. Please heed their
advice.

Now, let's make your problem a Perl problem. It appears you are using MS
Windows, perhaps XP. If so, you may be using ActiveState Perl or IndigoPerl.
If so, good!

Look at the documentation for the Perl module Mime::Lite. By following the
documentation,
you should be able to easily craft a Perl script that will work on your
Win32 system.

If your curiosity overwhelms you, look inside of Mime::Lite to see how it
sends mail for non-UNIX systems. Hint: Perl module Net::SMTP.

When you have a Perl problem, please read the posting guidelines, help
yourself as much as you can first, and return with a Perl question that's
not already answered in the documentation and other easily searchable
sources.

Cheers.

Bill Segraves
 
W

William Alexander Segraves

If your curiosity overwhelms you, look inside of Mime::Lite to see how it
sends mail for non-UNIX systems. Hint: Perl module Net::SMTP.

See also Mail::Mailer and Mail::Send.

Cheers.

Bill Segraves
 
H

Helgi Briem

I use this piece of code to mail myself but my operating system can't find
the mail command.
How would I make this command work with windows XP ?

open MAIL, "|mail zoo@/hotmail.com";
print MAIL "bad $somename guessed $someguess\n";
close MAIL;


'mail' is not recognized as an internal or external command,
operable program or batch file.

I wouldn't use an external 'mail' program.

I would use an appropriate Perl module,
thus moving this on-topic for a Perl newsgroup.

I have had good results with MIME::Lite. Here's how
you use it:

#!perl
use warnings;
use strict;
use MIME::Lite;

my ($sender,$recipent,$subject,$message,$mailserver) =
qw/me you whatever hello mail.mydomain.com/;

$msg = MIME::Lite->new(
From => $sender,
To => $recipient,
Subject => $subject,
Type =>'plain/text',
Data => $message,
);

$msg->send("smtp", $mailserver, Timeout=>10) or die $!;
__END__
 
W

William Alexander Segraves

should be

open MAIL, "|mail zoo\@hotmail.com";


Note to OP: With the above correction (and a bit of other help to make it a
complete script), the code you posted works fine on the Linux system to
which I ported it.

This is true.

You *could* get the code to work after a fashion with the |mail process
filehandle by writing a batch file, mail.bat, invoking msimn.exe, the
Outlook Express executable program, with the appropriate command line
parameters. Perl does indeed launch msimn.exe successfully in this case and
can even feed the command line params to the batch file, starting Outlook
Express, with the params stuffed in the right places. OTOH, that's about as
far as the success goes, as the process filehandle really doesn't function
correctly as a filehandle.

The following code (fragment) works on this Win32 (Win95SR1) workstation

open MAIL, "|mail $email $message";

with mail.bat invoking msimn.exe

msimn.exe /mailurl:mailto:%1?body=%2

That said (written), my recommendation is that you abandon the idea of using
a Perl process filehandle with Windows, as there are several much simpler
alternatives that use throroughly tested CPAN modules.
I wouldn't use an external 'mail' program.

Note to OP: Use Mime::Lite, as suggested by Mr. Briem. You will no doubt
find it to be an expedient and pleasing solution.

Cheers.

Bill Segraves
 
H

Helgi Briem

Note to OP: Use Mime::Lite, as suggested by Mr. Briem.
You will no doubt find it to be an expedient and pleasing
solution.

Note to OP: I suggested MIME::Lite, not Mime::Lite.

Case matters, Bill. ;-)

MIME is an acronym for "Multipurpose Internet Mail
Extension", and so should be spelled in all caps, unlike
Perl, which isn't an acronym for anything, although
some have been grafted on later.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top