An end run around the problem would be to write the message to a temporary
file and use the command line interface to MAIL.

  $file = 'tempfile.txt';
  open OUT, "> $file"  or  die "Can't open file $file: $!";
  print OUT "Message goes here, any number of lines\n";
  close OUT;
  $subject = "Mail subject";
  $maillist = '[EMAIL PROTECTED]';
  $result = `MAIL/subject="$subject" $file $maillist`;
  unlink $file;

--Bob van Keuren
Advanced Marketing Services
San Diego


-----Original Message-----
From: Martin Evans [mailto:[EMAIL PROTECTED]
Sent: Monday, July 28, 2003 7:20 am
To: [EMAIL PROTECTED]
Subject: RE: using vms mail



Many thanks for your replies, I've managed to get it going and keep it
simple whith VMS mail, part of my problem was some previous testing I had
been doing with "deliver" (freeware cd tool for filtering) it would also
appear that you don't need the control-z (which I should have had as
"\cZ") or the "exit\n" to quit mail.

in case anyone else wants to do this I've included the working code below,
please excuse the noddy comments, they're for a user.

#
#  create some vars for testing, these could be anything.
#
my $to          = '[EMAIL PROTECTED]';       # use single quotes here
or perl will expect an array @blah
my $subject     = "My subject goes in here";
my $name        = "Some text goes in here \n and some more on a new line
:-)";
my $location    = "And some more if I want to\n";
#
#
open(MAIL,"|mail") || die "Can't open mail\n";  # this line calls the mail
program and gives it the handle MAIL
print MAIL "send\n";                            # tells the mail program
you want to send a message
print MAIL "$to\n";                             # email address to send to
print MAIL "$subject\n";                        # the subject
print MAIL "$name\n";                           # some text for the body
print MAIL "$location\n";                       # some more text, you can
add as many as you like or just have one
close (MAIL)                                    # close the mail program



> Martin Evans wrote:
>> Hi can anyone give me any tips on how to interact with vms mail?
>
> I haven't personally used it, but how about VMS::Mail?
> Available from a friendly CPAN mirror near you.
>
> However, it's quite old (2000, inital release), listed as "cdc"
> (pre-alpha, support by developer, C and perl).
>
> Otherwise - if you have TCP/IP running on that machine - I'd suggest
> Net::SMTP (part of the libnet package).
>
> cu,
>   Martin
> --
> So long, and thanks        | Martin Vorlaender  | VMS & WNT programmer
> for all the books...       | work: [EMAIL PROTECTED]
> In Memoriam Douglas Adams  |  http://www.pdv-systeme.de/users/martinv/
>             1952-2001      | home: [EMAIL PROTECTED]
>


Martin Evans
AEON Solutions Ltd
Tel +44(0)7974 339915

Reply via email to