Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VMS to NT mail converter

9 views
Skip to first unread message

Virginia Metze

unread,
Apr 13, 1998, 3:00:00 AM4/13/98
to

I heard that there is somewhere a program that will convert VMS
mail to NT mail.

Can anyone tell me something about this?

Ginny Metze

Glen Martin

unread,
Apr 13, 1998, 3:00:00 AM4/13/98
to

OpenVMS Mail Integration Tools. See
<http://www.openvms.digital.com/openvms/products/mit/mail-index.html>.
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Glen Mark Martin E-Mail: glen...@utxvms.cc.utexas.edu _/
_/ University of Texas at Austin Phone: (512) 475-9311 _/
_/ ACITS OpenVMS/NT Services _/
_/ Austin, TX 78712 _/
_/ World-Wide Web: http://wwwvms.utexas.edu/~GLENMARK/index.html _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Virginia Metze

unread,
Apr 13, 1998, 3:00:00 AM4/13/98
to

--->Virginia Metze wrote:
>>
>> I heard that there is somewhere a program that will convert VMS
>> mail to NT mail.
>>
>> Can anyone tell me something about this?
>>
>> Ginny Metze
>
>OpenVMS Mail Integration Tools. See
><http://www.openvms.digital.com/openvms/products/mit/mail-index.html>.
>--

Thanks... that looks like it. Earlier discussions centered around something
that seemed to be Pathworks product, and we don't use Pathworks. But
this looks like just the thing. Thanks so much!

Ginny Metze

Glen Martin

unread,
Apr 13, 1998, 3:00:00 AM4/13/98
to

Virginia Metze wrote:

> >OpenVMS Mail Integration Tools. See
> ><http://www.openvms.digital.com/openvms/products/mit/mail-index.html>.
>

> Thanks... that looks like it. Earlier discussions centered around something
> that seemed to be Pathworks product, and we don't use Pathworks. But
> this looks like just the thing. Thanks so much!

Actually, I believe that the MIT package does require Pathworks...
--

Ed Wilts

unread,
Apr 13, 1998, 3:00:00 AM4/13/98
to

NT mail isn't a complete description.

For a few users, you may want to look at something as simple as Outlook or
Eudora. Both will connect to a POP3 or IMAP server, and you can relatively
quickly download all your messages.

.../Ed

--

Ed Wilts
Mounds View, MN
mailto:ewi...@winternet.com

Virginia Metze wrote in message
<000301bd6708$8e952420$3f67...@ginny.mrl.uiuc.edu>...

Miles Oliver

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

Pop indeed does work but when converting to MS Exchange/Outlook I have run
into a snag,

Exchange will mark the messages as received on the date of conversion,
losing the actual received date.

Using Eudora and pulling the messages via Pop the actual receive dates are
retained.

Im not finding much information on a workaround.

Miles D. Oliver - POSTMASTER Tech. Operations Manager
National Public Radio W. +1-202-414-2989
635 Massachusetts Ave NW FAX: +1-202-414-3051
Washington DC. 20001 Internet: mol...@npr.org
http://www.npr.org/
http://www.geocities.com/MotorCity/1328
http://www.off-road.com/~occweb

-----Original Message-----
From: John Macallister [mailto:J.Macal...@physics.ox.ac.uk]
Sent: Tuesday, April 14, 1998 6:21 AM
To: Info-Multinet (E-mail)
Cc: Myself (E-mail)
Subject: FW: VMS to NT mail converter


The Mail Integration Tool requires PATHWORKS at the VMS end.

It is possible, of course, to move mail from VMS to NT using POP but,
for users with many folders this can be tedious. The Mail Integration
Tool provides the possibility of moving mail in a single, simple,
point-click-drag operation.

John


Name: John B. Macallister E-mail: j.macal...@physics.ox.ac.uk
Post: Nuclear and Astrophysics Laboratory, Keble Road, Oxford OX1 3RH,UK
Phone: +44-1865-273388 (direct) 273333 (reception) 273418 (Fax)


David Sironi

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

My interest in the VMS Mail to MS Exchange on NT, and
VMS Mail to the Internet is:

We have installed an Alpha for our Oracle server migrating from a VAX
cluster environment whereon UUCP runs to connect our VMS MAil to the
internet. From Oracle we ocassionally mail 70 to 7,000 Emails to our
constituents. We have been using UUCP for that. We need to keep that
capability, (ie., large Emails to groups of people from Oracle on
Alpha).

Our main office user base use Exchange on an NT server. It has a
connection to the internet through a firewall router to our ISP. (Note,
the UUCP VAX method uses a separate dialout connection to the same ISP.)

My questions:

How do I get to the internet from Alpha for large Email jobs?

Can I (should I?) use the Exchange internet connection? How do I get
mail from Alpha to that NT Exchange server?

When sending large Email jobs, what facilities are there for handling
the undeliverable Emails that are returned?

Unlike the other discussion on this list service, I am not concerned
with moving users from VMS mail to NT Exchange. That has already
occurred.

Thanks for your wise counsel!

>----------
>From: Miles Oliver[SMTP:MOl...@npr.org]
>Sent: Tuesday, April 14, 1998 6:07 AM
>To: 'Info-M...@process.com'
>Subject: RE: VMS to NT mail converter

Virginia Metze

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to


>Date: Tue, 14 Apr 1998 11:20:34 +0100
>MIME-Version: 1.0
>Content-Type: text/plain
>List-Unsubscribe: <mailto:Info-Multi...@process.com?body=unsubscribe>


>
>The Mail Integration Tool requires PATHWORKS at the VMS end.
>
>It is possible, of course, to move mail from VMS to NT using POP but,
>for users with many folders this can be tedious. The Mail Integration
>Tool provides the possibility of moving mail in a single, simple,
>point-click-drag operation.
>

Yes, that is the problem I have with using POP. It is simply too tedious for
those
with many folders. What I was hoping for was a program which read a VMS
mail file and wrote an NT mail file which could then be downloaded to the NT
system.

I guess this is a dream?

Ginny

j.lance wilkinson, (814) 865-1818

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

In article <99E285AEE42AD1118E6...@npr-01-msg.npr.org>, Miles Oliver <MOl...@npr.org> writes:

>Using Eudora and pulling the messages via Pop the actual receive dates are
>retained.

If you're using PMDF, I have a DCL procedure which converts any mail
folder in any mail file into a EUDORA .MBX file suitable for
downloading. It's remarkable how similar the structure of the .MBX
file is to a simple EXTRACT from the PMDF UA.EXE. Since it's in DCL,
it's quite easy to adapt for other sites, I suspect.

+-"Never Underestimate the bandwidth of a station wagon full of mag tapes"--+
| J.Lance Wilkinson ("Lance") InterNet: Lance.W...@psu.edu |
| Systems Design Specialist - Lead AT&T: (814) 865-1818 |
| Library Computing Services FAX: (814) 863-3560 |
| E8 Pattee Library "I'd rather be dancing..." |
| Penn State University A host is a host from coast to coast, |
| University Park, PA 16802 And no one will talk to a host that's close |
| <postm...@psulias.psu.edu> Unless the host that isn't close |
| VMS GopherMeister Is busy, hung or dead. |
+------"He's dead, Jim. I'll get his tricorder. You take his wallet."-------+
<A Href="http://perdita.lcs.psu.edu">home page</a>
<a Href="http://perdita.lcs.psu.edu/junkdec.htm">junk mail declaration</a>

Gary Lee McDonald

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

Date sent: 14-APR-1998 11:36:08
>
>In article <99E285AEE42AD1118E6...@npr-01-msg.npr.org>, Miles Oliver <MOl...@npr.org> writes:
>
>>Using Eudora and pulling the messages via Pop the actual receive dates are
>>retained.
>
> If you're using PMDF, I have a DCL procedure which converts any mail
> folder in any mail file into a EUDORA .MBX file suitable for
> downloading. It's remarkable how similar the structure of the .MBX
> file is to a simple EXTRACT from the PMDF UA.EXE. Since it's in DCL,
> it's quite easy to adapt for other sites, I suspect.

I'd be interested in looking at it...

>
>+-"Never Underestimate the bandwidth of a station wagon full of mag tapes"--+
>| J.Lance Wilkinson ("Lance") InterNet: Lance.W...@psu.edu |
>| Systems Design Specialist - Lead AT&T: (814) 865-1818 |
>| Library Computing Services FAX: (814) 863-3560 |
>| E8 Pattee Library "I'd rather be dancing..." |
>| Penn State University A host is a host from coast to coast, |
>| University Park, PA 16802 And no one will talk to a host that's close |
>| <postm...@psulias.psu.edu> Unless the host that isn't close |
>| VMS GopherMeister Is busy, hung or dead. |
>+------"He's dead, Jim. I'll get his tricorder. You take his wallet."-------+
><A Href="http://perdita.lcs.psu.edu">home page</a>
><a Href="http://perdita.lcs.psu.edu/junkdec.htm">junk mail declaration</a>

UMKC GaryM.
5100 Rockhill Road Univ. of Mo. at K.C.
Cockefair Hall (816) 235-1183 (work) 346-3447 (pager)
Room 2, Gary Lee McDonald MCDONALD @ CCTR.UMKC.EDU
Kansas City, Mo. 64110 POSTMASTER @ CCTR.UMKC.EDU

Miles Oliver

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

-----Original Message-----
From: j...@psulias.psu.edu [mailto:j...@psulias.psu.edu]
Subject: RE: VMS to NT mail converter

>Using Eudora and pulling the messages via Pop the actual receive dates are
>retained.

If you're using PMDF, I have a DCL procedure which converts any mail
folder in any mail file into a EUDORA .MBX file suitable for
downloading. It's remarkable how similar the structure of the .MBX
file is to a simple EXTRACT from the PMDF UA.EXE. Since it's in
DCL,
it's quite easy to adapt for other sites, I suspect.

I've tried importing Eudora .MBX files into Exchange, Exchange seems to be
the culprit here, no matter what format I import, It still does not retain
the initial received date. Im dealing with Micro$oft on this as well.

Dan Sugalski

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

At 08:12 AM 4/14/1998 -0500, David Sironi wrote:
>My interest in the VMS Mail to MS Exchange on NT, and
>VMS Mail to the Internet is:
>
>We have installed an Alpha for our Oracle server migrating from a VAX
>cluster environment whereon UUCP runs to connect our VMS MAil to the
>internet. From Oracle we ocassionally mail 70 to 7,000 Emails to our
>constituents. We have been using UUCP for that. We need to keep that
>capability, (ie., large Emails to groups of people from Oracle on
>Alpha).
>
>Our main office user base use Exchange on an NT server. It has a
>connection to the internet through a firewall router to our ISP. (Note,
>the UUCP VAX method uses a separate dialout connection to the same ISP.)
>
>
>My questions:
>
>How do I get to the internet from Alpha for large Email jobs?

Go through the firewall like the NT box does. Or use the NT box as an SMTP
relay, if it supports that. Or (option three) set up a third box (like a
linux box, say) that acts as a mail gateway and have *both* the exchange
box and the Alpha route mail through it.

I don't think I'd use the exchange server as a relay, though--so much else
about it sucks rocks that I wouldn't trust it to deliver the mail properly.

>Can I (should I?) use the Exchange internet connection? How do I get
>mail from Alpha to that NT Exchange server?

Can/should? Probably. The connection's already there, after all. Might as
well use it.

How you get mail to the exchange box depends. If you're looking to send
mail to users on it, then just do it. If you need to use it as a relay,
check out the 'forwarding through a mail hub' section of the multinet admin
guide. (Pages 8-9 through 8-13, and 'Configuring mail gateways' on pages
8-14 and 8-15.

>When sending large Email jobs, what facilities are there for handling
>the undeliverable Emails that are returned?

Well, they'll bounce, of course. If you set the from address properly when
sending the mail, they'll bounce to wherever you like.

You have another option if you want to keep the UUCP connection. Get a
cheap Linux box and set it up as a mail gateway, and configure it to send
all its mail out via UUCP. (My home box is set up this way, and it was
simple enough.) Stick it in there in place of the vaxen that are going away.

Which is better depends on the mail you're sending (is that one message
with 70,000 people in the To: line, or 70,000 mail messages to one person
each?), the size of your pipe to the internet, your ISP's mail server
capacity, and your deal with the ISP. If you've got a reasonably good sized
pipe (fractional T1 at least), then I'd go ahead and send the mail using
the link, either with a SMTP product on the Alpha (Probably MX 5.0, rather
than Multinet) or with another box (Linux with sendmail or qmail'd be best)

Dan

---------------------------------------------"it's like this"--------------
Dan Sugalski (541) 737-3346 even samurai
SysAdmin have teddy bears
Oregon University System and even the teddy bears
suga...@ous.edu get drunk

Jim Mehlhop

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

At 12:50 PM 4/14/98 -0400, you wrote:
>
>-----Original Message-----
>From: j...@psulias.psu.edu [mailto:j...@psulias.psu.edu]
>Subject: RE: VMS to NT mail converter
>
>>Using Eudora and pulling the messages via Pop the actual receive dates are
>>retained.
>
> If you're using PMDF, I have a DCL procedure which converts any mail
> folder in any mail file into a EUDORA .MBX file suitable for
> downloading. It's remarkable how similar the structure of the .MBX
> file is to a simple EXTRACT from the PMDF UA.EXE. Since it's in
>DCL,
> it's quite easy to adapt for other sites, I suspect.
>
> I've tried importing Eudora .MBX files into Exchange, Exchange seems to be
>the culprit here, no matter what format I import, It still does not retain
>the initial received date. Im dealing with Micro$oft on this as well.

Easy solution DON'T USE EXCHANGE. I think the best solution for a robust
mail system is VMS as POP/IPAM/SMTP and Eudora as a PC client.

Personal Opinion Only.
Jim

>
>
>+-"Never Underestimate the bandwidth of a station wagon full of mag
>tapes"--+
>| J.Lance Wilkinson ("Lance") InterNet: Lance.W...@psu.edu
>|
>| Systems Design Specialist - Lead AT&T: (814) 865-1818
>|
>| Library Computing Services FAX: (814) 863-3560
>|
>| E8 Pattee Library "I'd rather be dancing..."
>|
>| Penn State University A host is a host from coast to coast,
>|
>| University Park, PA 16802 And no one will talk to a host that's close
>|
>| <postm...@psulias.psu.edu> Unless the host that isn't close
>|
>| VMS GopherMeister Is busy, hung or dead.
>|
>+------"He's dead, Jim. I'll get his tricorder. You take his
>wallet."-------+
><A Href="http://perdita.lcs.psu.edu">home page</a>
><a Href="http://perdita.lcs.psu.edu/junkdec.htm">junk mail declaration</a>
>
>

_________________________________________________________________________
Jim Mehlhop, Support Engineer
Process Software
Meh...@process.com
Phone 719-638-8448
Join Cauce to outlaw spam
http://www.cauce.org/
_________________________________________________________________________


Support

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

In article <c=US%a=_%p=InterVarsity_Chr%l=NSCNT1-9804...@nscnt1.ivcf.org>, David Sironi <Sir...@IVCF.ORG> wrote:
>My interest in the VMS Mail to MS Exchange on NT, and
>VMS Mail to the Internet is:
>
>We have installed an Alpha for our Oracle server migrating from a VAX
>cluster environment whereon UUCP runs to connect our VMS MAil to the
>internet. From Oracle we ocassionally mail 70 to 7,000 Emails to our
>constituents. We have been using UUCP for that. We need to keep that
>capability, (ie., large Emails to groups of people from Oracle on
>Alpha).
>

What operating system are you running on the "Alpha for Oracle" ?

If VMS, then where did you get UUCP (and can I get it) ?

>Our main office user base use Exchange on an NT server. It has a
>connection to the internet through a firewall router to our ISP. (Note,
>the UUCP VAX method uses a separate dialout connection to the same ISP.)
>
>
>My questions:
>
>How do I get to the internet from Alpha for large Email jobs?
>

Since you already have a direct connection to your ISP, use that. Innosoft
makes mail product called PMDf that does smtp and pop (and more). Then
you can get rid of uucp and that other dial up line.
I'm suprised your ISP didn't recommend this solution instead of charging
you for two different services

>Can I (should I?) use the Exchange internet connection? How do I get
>mail from Alpha to that NT Exchange server?
>

Don't need to if you use above solution..

>When sending large Email jobs, what facilities are there for handling
>the undeliverable Emails that are returned?
>

PMDF has facilties for handling returned mail.

>Unlike the other discussion on this list service, I am not concerned
>with moving users from VMS mail to NT Exchange. That has already
>occurred.
>
>Thanks for your wise counsel!
>


Bruce Taube
Info Avenue Internet

mcki...@cpgtsa.dcs.saic.com

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

In article <99E285AEE42AD1118E6...@npr-01-msg.npr.org>,
Miles Oliver <MOl...@npr.org> writes:
> Pop indeed does work but when converting to MS Exchange/Outlook I have run
> into a snag,
>
> Exchange will mark the messages as received on the date of conversion,
> losing the actual received date.
>
> Using Eudora and pulling the messages via Pop the actual receive dates are
> retained.
>
> Im not finding much information on a workaround.
>

Perhaps this might help if you've got a C compiler. This program will use
smtp to move the mail from the original VMS system to any other smtp host
by using localhost as an smtp forwarder (you'll need to insure that your
host does not disallow this). Read the comments at the top of the code
before using (of course you should probably read all the code to). It will
attempt to preserve all headers (including dates). In doing this, if a bad
destination address is targeted all messages will bounce to original
sender even if they are years old... be careful.

- Jim
--------------------------------- cut here ---------------------------- mfu.doc
MFU.DOC

The MFU utility was written to address the migration of VMSmail to another,
usually non-VMS environment. This program will allow the user to impersonate
the sender of each and every VMSmail message in the mailfile by opening an
smtp connection to localhost (from the source machine which is presumed to be
running Multinet as the TCP/IP stack) and walking through the mailfile, and
fetching and delivering each message to the target host and user. See the
usage and comments within the source for additional info.

Some examples of usage are as follow:

$ mfu := $sys$disk:[]mfu
$
$! display usage/help info
$ mfu
$
$! list the folder names and number of associated messages in default mail.mai
$ mfu -i
$
$! list the folder names and number of associated messages in [.old]mail.mai
$ mfu -i -m[.old]
$
$! forward messages in default mail.mai to forwarding address in VMSMAIL_PROFILE
$ mfu -d
$
$! forward messages in folder PRIVATE to fr...@np.org and note it on sys$output
$ mfu -fprivate -tf...@np.org -v
$
$! forward all messages in disk$user01:[fred.mail] to fr...@np.org, delete
$! the original messages after sending, and note it all on sys$output
$ mfu -mdisk$user01:[fred.mail] -tf...@np.org -p -z -v
$

--------------------------------- cut here ---------------------------- mfu.c
/* mfu.c - jfm */

#ifdef __DECC
# pragma module MFU "OpenVMS MAIL Forward Utility"
#else
#module MFU "OpenVMS MAIL Forward Utility"
#endif

/* mail_forward_utility (mfu)
*
* The default action of this routine will result in all messages of the
* caller's default VMSmail file being forwarded to the address designated
* as this user's forwarding address in VMSMAIL_PROFILE. Alternatively, the
* caller may select an alternate mail file, a specific folder within the
* selected mail file, an alternate forwarding address and/or deletion of
* forwarded mail messages. It is also possible to inspect the mail file
* without forwarding. See "usage" routine within this file. SMTP addresses
* need not be quoted on the command line.
*
* This routine runs in user mode but will require SYSPRV and that the
* DECnet MAIL object must have SYSPRV privilege on OUTGOING CONNECT in order
* to preserve the original message's From: field during forwarding that does
* not target an internet (smtp) mailbox. This routine should not be run as a
* detached process without calling LOGINOUT to define SYS$SCRATCH since the
* mail$send_add_bodypart routine desires to build it's temp files there.
*
* The actual mail forward routine will utilize VMS' mail$send_XXXX routines
* for VMS style forwarding address and will use a socket connection to the
* LOCALHOST for smtp mail. We'll hand all smtp mail to localhost and let
* it do delivery (since we can be guaranteed that localhost is up and the
* target may not be).
*
*
* Also, be _very_ careful with entering the forwarding address on the command
* line. If you mess it up and the result is
*
* unknown_user@valid_host.valid_domain
*
* you'll end up with all the messages delivered to the host; and then the
* host's postmaster returning them to the _original_ sender. Try explaining
* that; especially if it involves thousands of _vintage_ messages. Perhaps
* this program should not be shared with the user community and should
* only be executed in a controlled environment. You _can_ point it at any
* mail file after all.
*
*
* Orignal environment:
* OpenVMS Alpha V6.1/Multinet 3.5B/DECC 5.0-003 : user mode
*
* $ cc mfu
* $ link/notrace mfu,sys$input:/option
* multinet_socket_library/share
* ^z
* $ install add mfu/privilege=sysprv ! not necessary for smtp forward
* $ mcr ncp set object mail privilege sysprv ! not necessary for smtp forward
* $ mfu := $mfu
* $ mfu
*/

#include <ctype.h> /* character type definitions */
#include <descrip.h> /* descriptor definitions */
#include <jpidef.h> /* $getjpi codes */
#include <maildef.h> /* MAIL$ definitions */
#include <nam.h> /* NAM$ definitions */
#include <prvdef.h> /* privliege definitions */
#include <ssdef.h> /* system service status */
#include <stdio.h> /* standard I/O definitions */
#include <stdlib.h> /* standard library functions */
#include <string.h> /* string definitions */
#include <starlet.h> /* system definitions */

#include "multinet_root:[multinet.include.sys]types.h"
#include "multinet_root:[multinet.include.sys]socket.h"
#include "multinet_root:[multinet.include.netinet]in.h"
#include "multinet_root:[multinet.include]netdb.h"

#define FACILITY "%mfu" /* this be us (~ebonics) */
#define USERNAME_SIZE 12 /* length of a username */
#define DISABLE 0 /* $SETPRV disable privilege */
#define ENABLE 1 /* $SETPRV enable privilege */
#define TEMPORARY 0 /* $SETPRV temporary */

/* command line option values */
#define DEFAULT 1
#define FOLDER 2
#define INSPECT 4
#define MAILFILE 8
#define PURGE 16
#define TO 32
#define VERBOSE 64

/* SMTP status codes returned as the first 4 bytes of a text message */
#define SMTPGREET (long) "220 " /* SMTP successful greeting */
#define SMTPOK (long) "250 " /* SMTP OK code */
#define SMTPREADY (long) "354 " /* SMTP ready for data */

#define SMTPBUFLEN 512 /* maximum record length */
#define HOSTNAMELEN 128 /* maximum host name length */

struct smtp_stream
{
char *hostname; /* host name */
char *iobuffer; /* io buffer */
short sock; /* socket */
};

struct msgblk
{
int *msgctx; /* MAIL$MESSAGE_xxxx context */
int msg_id; /* message id */
char *forwarding; /* mail forward address */
char *defspec; /* default filespec */
int smtpflag; /* SMTP indicator */
int cmdflags; /* command line indicators */
};

struct itmlst /* system service item list */
{
unsigned short length;
unsigned short code;
char *bufadr;
unsigned long *retlen;
};

struct node /* linked list of MAIL folders */
{
struct node *next;
char *folder_name;
};

/* mail$ status values from STARLET.MLB/$MAILMSGDEF (no .h file yet) */
#ifndef MAIL$_OPENIN
#define MAIL$_OPENIN 8290802
#endif
#ifndef MAIL$_MSGINFO
#define MAIL$_MSGINFO 8322313
#endif
#ifndef MAIL$_MSGTEXT
#define MAIL$_MSGTEXT 8322305
#endif

/* callable mail$ routines, perhaps someday there'll be a .h file */
int mail$mailfile_begin(), mail$mailfile_open(), mail$mailfile_info_file(),
mail$mailfile_purge_waste(), mail$mailfile_close(), mail$mailfile_end(),
mail$message_begin(), mail$message_select(), mail$message_get(),
mail$message_delete(), mail$message_end(),
mail$send_begin(), mail$send_add_address(), mail$send_add_attribute(),
mail$send_add_bodypart(), mail$send_message(), mail$send_end(),
mail$user_begin(), mail$user_get_info(), mail$user_set_info(),
mail$user_end();

void usage(status)
{
printf("Usage is: mfu [options]\
\nOptions:\
\n\t-d\t\tdefault\
\n\t-f[value]\tfolder (where value is a valid VMSmail folder name)\
\n\t-i\t\tinspect messages only\
\n\t-m[value]\tmailfile (where value is a valid VMSmail filespec)\
\n\t-p\t\tpurge forwarded messages\
\n\t-t[value]\tto (where value is a valid destination mail address)\
\n\t-v\t\tverbose\
\n\nThe default action is to forward all of the user's mail from all folders\
\nto the address specified in VMSMail's FORWARD field. The optional-args values\
\nare as would be expected. The -d option (default) is to be used exclusive of\
\nall other options excepting -p (purge) and -v (verbose). The -i (inspect)\
\noption is to be used exclusive of all other options except -f (folder) and\
\n-m (mailfile).\
\n\n");
exit(status);
}


int smtp_receive(struct smtp_stream *stream, long expected_status)
{
if (socket_read(stream->sock, stream->iobuffer, SMTPBUFLEN-1) < 0)
{
socket_perror("smtp_receive socket_read error");
return(SS$_ABORT);
}
if (strncmp(stream->iobuffer, (char *)expected_status, 4) != 0)
{
printf("%s-f-fatal, failed to receive expected SMTP status\n", FACILITY);
printf("-smtp_receive returned\n/%s/\n", stream->iobuffer);
return(SS$_ABORT);
}
return(SS$_NORMAL);
}


int smtp_send(struct smtp_stream *stream)
{
if (socket_write(stream->sock, stream->iobuffer,
strlen(stream->iobuffer)) < 0)
{
socket_perror("smtp_send socket_write error");
return(SS$_ABORT);
}
return(SS$_NORMAL);
}


int smtp_start(struct smtp_stream *stream)
{
register r0;
char localhost[HOSTNAMELEN], buffer[SMTPBUFLEN];
struct sockaddr_in sin;
struct hostent *host;
struct servent *service;
void bcopy(void *__source, void *__destination, int __length);

/* get our hostname */
if (gethostname(localhost, HOSTNAMELEN-1) != 0)
{
printf("%s-f-fatal, smtp_start gethostname failed", FACILITY);
return(SS$_ABORT);
}
/* get the target host info */
host = gethostbyname(stream->hostname);
if (host == NULL)
{
printf("%s-f-fatal, smtp_start gethostbyname /%s/ failed",
FACILITY, stream->hostname);
return(SS$_ABORT);
}
/* create the socket */
stream->sock = socket(host->h_addrtype, SOCK_STREAM, 0);
if (stream->sock < 0)
{
socket_perror("smtp_start socket error");
return(SS$_ABORT);
}
/* get the lowdown on the smtp service */
service = getservbyname("smtp", "tcp");
if (service == NULL)
{
printf("%s-f-fatal, smtp_start getservbyname /smtp/ unknown", FACILITY);
return(SS$_ABORT);
}
/* fill in our sockaddr_in structure describing the port */
sin.sin_family = host->h_addrtype;
bcopy(host->h_addr, &sin.sin_addr, host->h_length);
sin.sin_port = service->s_port;
/* connect to the target server */
if (connect(stream->sock, &sin, sizeof(sin)) < 0)
{
socket_perror("smtp_start connect error");
return(SS$_ABORT);
}
/* and initiate a smtp conversation */
stream->iobuffer = &buffer[0];
if (smtp_receive(stream, SMTPGREET) != SS$_NORMAL) return(SS$_ABORT);
sprintf(stream->iobuffer, "HELO <%s>\r\n", localhost);
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (smtp_receive(stream, SMTPOK) != SS$_NORMAL) return(SS$_ABORT);
return(SS$_NORMAL);
}


int smtp_finish(struct smtp_stream *stream)
{
socket_write(stream->sock, "QUIT\r\n", sizeof("QUIT\r\n"));
if (socket_close(stream->sock) < 0)
{
socket_perror("smtp_finish socket_close error");
return(SS$_ABORT);
}
return(SS$_NORMAL);
}


void unquote(char *string)
/* find the first and last quote in a string and return what is found between */
/* note that this will conveniently remove the SMTP% (or IN%) as well as the */
/* quote characters when dealing with mail addresses */
{
char *ptr;
ptr = strchr(string, '"') + 1;
*strrchr(ptr, '"') = '\0';
strcpy(string, ptr);
}


int get_folder_routine(struct node *folder_list, struct dsc$descriptor *name)
{
/* build a linked list of all mail folders, invoked as an action routine */
/* from MAIL$MAILFILE_INFO_FILE, later used to select messages, one folder */
/* at a time */
if (name->dsc$w_length)
{
while (folder_list->next) folder_list = folder_list->next;
folder_list->next = malloc(sizeof(struct node));
folder_list = folder_list->next;
folder_list->next = 0;
folder_list->folder_name = malloc(name->dsc$w_length + 1);
strncpy(folder_list->folder_name, name->dsc$a_pointer, name->dsc$w_length);
folder_list->folder_name[name->dsc$w_length] = '\0';
}
return(SS$_NORMAL);
}


int forward_message_routine(struct msgblk *msgvec, struct smtp_stream *stream)
/* given a pointer to the message context block, the message id, a forwarding */
/* address, a flag indicating whether it's a SMTP address, default file spec */
/* that indicates the device and directory of any external (to MAIL.MAI or */
/* other master file) messages and a flag that indicates whether to delete */
/* the message after processing; we'll get each and resend it, attempting to */
/* preserve the original sender's From: address the original "To:", the */
/* original "CC:" list and the original subject. Then depending upon the */
/* delete flag we might delete the original message. */
{
static unsigned long message_id;
static unsigned short message_record_type;
static char message_sender[NAM$C_MAXRSS];
static unsigned long message_sender_len = 0;
static char message_to[NAM$C_MAXRSS];
static unsigned long message_to_len = 0;
static char message_cc[NAM$C_MAXRSS];
static unsigned long message_cc_len = 0;
static char message_subject[NAM$C_MAXRSS];
static unsigned long message_subject_len = 0;
static char message_date[NAM$C_MAXRSS];
static unsigned long message_date_len = 0;
static char message_record[NAM$C_MAXRSS];
static unsigned long message_record_len = 0;
static char message_extid[NAM$C_MAXRSS];
static unsigned long message_extid_len = 0;
int send_message_context = 0, construct_smtp_headers = 0;
register r0;

struct itmlst null_itmlst[] = {0, 0, 0, 0};

/* first item will be filled later */
struct itmlst message_get_in_itmlst[] =
{ {0, 0, 0, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst message_get_out_itmlst_info[] =
{ {sizeof(message_extid), MAIL$_MESSAGE_EXTID, message_extid,
&message_extid_len},
{sizeof(message_id), MAIL$_MESSAGE_CURRENT_ID, (char *)&message_id, 0},
{sizeof(message_sender), MAIL$_MESSAGE_SENDER, message_sender,
&message_sender_len},
{sizeof(message_to), MAIL$_MESSAGE_TO, message_to, &message_to_len},
{sizeof(message_cc), MAIL$_MESSAGE_CC, message_cc, &message_cc_len},
{sizeof(message_subject), MAIL$_MESSAGE_SUBJECT, message_subject,
&message_subject_len},
{sizeof(message_date), MAIL$_MESSAGE_DATE, message_date,
&message_date_len},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst message_get_out_itmlst_text[] =
{ {sizeof(message_record), MAIL$_MESSAGE_RECORD, message_record,
&message_record_len},
{sizeof(message_record_type), MAIL$_MESSAGE_RECORD_TYPE,
(char *)&message_record_type, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };

message_id = msgvec->msg_id;
message_get_in_itmlst[0].length = sizeof(message_id);
message_get_in_itmlst[0].code = MAIL$_MESSAGE_ID;
message_get_in_itmlst[0].bufadr = (char *)&message_id;
r0 = mail$message_get(msgvec->msgctx, &message_get_in_itmlst,
&message_get_out_itmlst_info);
if (r0 == MAIL$_OPENIN) return(MAIL$_OPENIN);
if (r0 != MAIL$_MSGINFO) return(SS$_ABORT);
message_subject[message_subject_len] = message_cc[message_cc_len] =
message_to[message_to_len] = message_extid[message_extid_len] =
message_sender[message_sender_len] = '\0';

/* from here there are two paths outbound... smtp or VMSmail */
if (msgvec->smtpflag)
/* if our forwarding address is smtp format, then */
{
construct_smtp_headers = 1; /* assume we need to supply headers */
if (strchr(message_sender, '@'))
/* if our forwarding address is smtp format, and the original message */
/* was an smtp message, then we'll need to pre-read the message and */
/* search for the smtp headers that will usually be found at the */
/* beginning of the message body. This is necessary since some smtp */
/* servers can be configured to discard smtp headers. In that case */
/* it will be necessary for us to later reconstruct the smtp header */
/* as we send the message. What we'll do here is initialize a flag */
/* with the last four bits on. Then for each of our four mandatory */
/* header records found we'll flip the bit off. If we find all four, */
/* the flag will have value zero, we needn't reconstruct headers. */
{
int smtp_noheaders=15;
message_get_in_itmlst[0].length = 0;
message_get_in_itmlst[0].code = MAIL$_MESSAGE_CONTINUE;
message_get_in_itmlst[0].bufadr = 0;
/* read the message */
while (mail$message_get(msgvec->msgctx, &message_get_in_itmlst,
&message_get_out_itmlst_text) == MAIL$_MSGTEXT)
{
if (message_record_type == MAIL$_MESSAGE_TEXT)
{
message_record[message_record_len] = '\0';
/* look for smtp headers */
if (strstr(message_record, "From:") != NULL)
smtp_noheaders ^= 1;
if (strstr(message_record, "To:") != NULL)
smtp_noheaders ^= 2;
if (strstr(message_record, "Date:") != NULL)
smtp_noheaders ^= 4;
if (strstr(message_record, "Subject:") != NULL)
smtp_noheaders ^= 8;
if (smtp_noheaders == 0)
{
/* found all the required smtp header records */
construct_smtp_headers = 0;
break;
}
}
}
/* reset context to beginning of message for sending */
message_get_in_itmlst[0].length = sizeof(message_id);
message_get_in_itmlst[0].code = MAIL$_MESSAGE_ID;
message_get_in_itmlst[0].bufadr = (char *)&message_id;
r0 = mail$message_get(msgvec->msgctx, &message_get_in_itmlst,
&message_get_out_itmlst_info);
if (r0 != MAIL$_MSGINFO) return(SS$_ABORT);
message_subject[message_subject_len] = message_cc[message_cc_len] =
message_to[message_to_len] = message_extid[message_extid_len] =
message_sender[message_sender_len] = '\0';
}
stream->iobuffer = &message_record[0];
if (strchr(message_sender, '"')) unquote(message_sender);
sprintf(stream->iobuffer, "MAIL FROM: <%s>\r\n", message_sender);
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (smtp_receive(stream, SMTPOK) != SS$_NORMAL) return(SS$_ABORT);
sprintf(stream->iobuffer, "RCPT TO: <%s>\r\n", msgvec->forwarding);
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (smtp_receive(stream, SMTPOK) != SS$_NORMAL) return(SS$_ABORT);
sprintf(stream->iobuffer, "DATA\r\n");
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (smtp_receive(stream, SMTPREADY) != SS$_NORMAL) return(SS$_ABORT);
/* not originally a smtp message? so turn it into a smtp message */
/* an smtp message missing smtp headers? then add them... */
if (construct_smtp_headers)
{
sprintf(stream->iobuffer, "Date: %s\r\n", message_date);
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (strchr(message_sender, ':'))
/* originally a DECnet sender? use this return address */
sprintf(stream->iobuffer, "From: %s <NoReply@aDECnetAddress>\r\n",
message_sender);
else
/* or if smtp without smtp headers, use message_sender address */
if (strchr(message_sender, '@'))
sprintf(stream->iobuffer, "From: <%s>\r\n", message_sender);
else
/* or some other address type? use this return address */
sprintf(stream->iobuffer, "From: %s <NoReply@aVMSaddress>\r\n",
message_sender);
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (strchr(message_to, ':'))
/* originally a DECnet recipient? use this to address */
sprintf(stream->iobuffer, "To: %s <NoReply@aDECnetAddress>\r\n",
message_to);
else
/* or if smtp without smtp headers, use message_sender address */
if (strchr(message_sender, '@'))
sprintf(stream->iobuffer, "To: <%s>\r\n", message_to);
else
/* or some other address type? use this return address */
sprintf(stream->iobuffer, "To: %s <NoReply@aVMSaddress>\r\n",
message_to);
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
/* need to parse the list and remove any foreign intros for cc's */
/* if (message_cc_len) */
/* { */
/* sprintf(stream->iobuffer, "Cc: %s\r\n", message_cc); */
/* if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT); */
/* } */
sprintf(stream->iobuffer, "Subject: %s\r\n", message_subject);
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
sprintf(stream->iobuffer, "\r\n");
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
}
message_get_in_itmlst[0].length = 0;
message_get_in_itmlst[0].code = MAIL$_MESSAGE_CONTINUE;
message_get_in_itmlst[0].bufadr = 0;
while (mail$message_get(msgvec->msgctx, &message_get_in_itmlst,
&message_get_out_itmlst_text) == MAIL$_MSGTEXT)
{
if (message_record_type == MAIL$_MESSAGE_TEXT)
{
message_record[message_record_len] = '\0';
strcat(message_record, "\r\n");
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
}
}
sprintf(stream->iobuffer, "\r\n.\r\n");
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (smtp_receive(stream, SMTPOK) != SS$_NORMAL) return(SS$_ABORT);
sprintf(stream->iobuffer, "RSET\r\n");
if (smtp_send(stream) != SS$_NORMAL) return(SS$_ABORT);
if (smtp_receive(stream, SMTPOK) != SS$_NORMAL) return(SS$_ABORT);
}

else
/* else if it's another VMS address, then */
{
/* 1st item to be filled in later */
struct itmlst send_address_in_itmlst[] =
{ {0, MAIL$_SEND_USERNAME, 0, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
/* do not alter the position of the send_attribute_in_itmlst items */
struct itmlst send_attribute_in_itmlst[] =
{ {0, MAIL$_SEND_CC_LINE, message_cc, 0},
{0, MAIL$_SEND_FROM_LINE, message_sender, 0},
{0, MAIL$_SEND_SUBJECT, message_subject, 0},
{0, MAIL$_SEND_TO_LINE, message_to, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
/* items to be filled in later */
struct itmlst send_bodypart_in_itmlst[] =
{ {0, 0, 0, 0},
{0, 0, 0, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
r0 = mail$send_begin(&send_message_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
send_address_in_itmlst[0].length = strlen(msgvec->forwarding);
send_address_in_itmlst[0].bufadr = msgvec->forwarding;
r0 = mail$send_add_address(&send_message_context, &send_address_in_itmlst,
&null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
send_attribute_in_itmlst[0].length = message_cc_len;
send_attribute_in_itmlst[1].length = message_sender_len;
send_attribute_in_itmlst[2].length = message_subject_len;
send_attribute_in_itmlst[3].length = message_to_len;
r0 = mail$send_add_attribute(&send_message_context,
&send_attribute_in_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
if (message_extid_len)
{
send_bodypart_in_itmlst[0].length = message_extid_len;
send_bodypart_in_itmlst[0].code = MAIL$_SEND_FILENAME;
send_bodypart_in_itmlst[0].bufadr = message_extid;
send_bodypart_in_itmlst[1].length = strlen(msgvec->defspec);
send_bodypart_in_itmlst[1].code = MAIL$_SEND_DEFAULT_NAME;
send_bodypart_in_itmlst[1].bufadr = msgvec->defspec;
r0 = mail$send_add_bodypart(&send_message_context,
&send_bodypart_in_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
}
else
{
message_get_in_itmlst[0].length = 0;
message_get_in_itmlst[0].code = MAIL$_MESSAGE_CONTINUE;
message_get_in_itmlst[0].bufadr = 0;
send_bodypart_in_itmlst[1].length = 0;
send_bodypart_in_itmlst[1].code = 0;
send_bodypart_in_itmlst[1].bufadr = 0;
send_bodypart_in_itmlst[0].code = MAIL$_SEND_RECORD;
while (mail$message_get(msgvec->msgctx, &message_get_in_itmlst,
&message_get_out_itmlst_text) == MAIL$_MSGTEXT)
{
if (message_record_type == MAIL$_MESSAGE_TEXT)
{
send_bodypart_in_itmlst[0].length = message_record_len;
send_bodypart_in_itmlst[0].bufadr = message_record;
r0 = mail$send_add_bodypart(&send_message_context,
&send_bodypart_in_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
}
}
}
r0 = mail$send_message(&send_message_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
r0 = mail$send_end(&send_message_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
}

if (msgvec->cmdflags & PURGE)
{
struct itmlst message_delete_in_itmlst[] =
{ {sizeof(message_id), MAIL$_MESSAGE_ID, (char *)&message_id, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
r0 = mail$message_delete(msgvec->msgctx, &message_delete_in_itmlst,
&null_itmlst);
if (r0 != SS$_NORMAL) return(r0);
}

return(SS$_NORMAL);
}

int main(int argc, char *argv[])
{
static int pid, privileges[2];
static int forwarded_messages=0, reset_newmail_count=0;
static int file_context=0, message_context=0, user_context=0;
static short int new_messages=0;
static char username[USERNAME_SIZE+1];
static char localhost[] = "localhost";
static char forwarding[NAM$C_MAXRSS];
static char mailfile_resultspec[NAM$C_MAXRSS];
static unsigned long mailfile_resultspec_len = 0;
static unsigned long forwarding_len = 0;
static int mailfile_indexed=0, messages_selected = 0;
static struct node folder_list = {0, 0};

struct smtp_stream stream = {0, 0, 0};

struct msgblk msgvec =
{&message_context, 0, &forwarding[0], &mailfile_resultspec[0], 0, 0};

char *folder, *mailfile, *to;
int cmdflags=0, smtp=0;
register i, r0;

struct itmlst null_itmlst[] = {0, 0, 0, 0};
struct itmlst user_get_in_itmlst[] =
/* username item must be 1st in list since it is referenced here later */
{ {0, MAIL$_USER_USERNAME, username, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst user_get_out_itmlst[] =
{ {sizeof(forwarding), MAIL$_USER_FORWARDING, forwarding, &forwarding_len},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst mailfile_info_itmlst[] =
{ {4, MAIL$_MAILFILE_FOLDER_ROUTINE, (char *)get_folder_routine, 0},
{4, MAIL$_MAILFILE_USER_DATA, (char *)&folder_list, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst message_in_itmlst[] =
{ {sizeof(file_context), MAIL$_MESSAGE_FILE_CTX, (char *)&file_context, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst mailfile_in_itmlst[] =
/* we'll fill in the first item later depending upon user input */
{ {0, 0, 0, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst mailfile_out_itmlst[] =
{ {sizeof(mailfile_indexed), MAIL$_MAILFILE_INDEXED,
(char *)&mailfile_indexed, 0},
{sizeof(mailfile_resultspec), MAIL$_MAILFILE_RESULTSPEC,
mailfile_resultspec, &mailfile_resultspec_len},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst message_select_in_itmlst[] =
/* folder item must be 1st in list since it is referenced here later */
{ {0, MAIL$_MESSAGE_FOLDER, 0, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst message_select_out_itmlst[] =
{ {sizeof(messages_selected), MAIL$_MESSAGE_SELECTED,
(char *)&messages_selected, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst mailfile_close_in_itmlst[] =
{ {0, MAIL$_MAILFILE_FULL_CLOSE, 0, 0},
{0, MAIL$_NOSIGNAL, 0, 0},
{0, 0, 0, 0} };
struct itmlst jpi_itmlst[] =
{ {USERNAME_SIZE, JPI$_USERNAME, username, 0},
{sizeof(pid), JPI$_PID, (char *)&pid, 0},
{sizeof(privileges), JPI$_PROCPRIV, (char *)&privileges, 0},
{0, JPI$C_LISTEND, 0, 0} };


if (argc<2) usage(SS$_INSFARG);

for (i=1; i<argc; i++)
{
char *ap;
if (*(ap = argv[i]) == '-')
{
switch (*++ap)
{
case 'd':
cmdflags += DEFAULT;
continue;
case 'f':
cmdflags += FOLDER;
for (folder=++ap; *ap; ap++) *ap = _toupper(*ap);
if (!(strlen(folder)))
{
printf("%s-f-fatal, FOLDER selected; no value supplied\n\n",
FACILITY);
usage(SS$_BADPARAM);
}
continue;
case 'i':
cmdflags += INSPECT;
continue;
case 'm':
cmdflags += MAILFILE;
mailfile = ++ap;
if (!(strlen(mailfile)))
{
printf("%s-f-fatal, MAILFILE selected; no value supplied\n\n",
FACILITY);
usage(SS$_BADPARAM);
}
mailfile_in_itmlst[0].length = strlen(mailfile);
mailfile_in_itmlst[0].code = MAIL$_MAILFILE_NAME;
mailfile_in_itmlst[0].bufadr = mailfile;
continue;
case 'p':
cmdflags += PURGE;
continue;
case 't':
cmdflags += TO;
to = ++ap;
if (!(strlen(to)))
{
printf("%s-f-fatal, TO selected; no value supplied\n\n", FACILITY);
usage(SS$_BADPARAM);
}
if (strchr(to, '"')) unquote(to);
continue;
case 'v':
cmdflags += VERBOSE;
continue;
default:
printf("%s-f-fatal, unrecognized option -%s\n\n", FACILITY, ap);
usage(SS$_BADPARAM);
}
}
else
{
printf("%s-f-fatal, unrecognized option %s\n\n", FACILITY, ap);
usage(SS$_BADPARAM);
}
}

/* don't allow both default and one of these others */
if ( (cmdflags & DEFAULT) &&
( ((cmdflags & FOLDER) +
(cmdflags & MAILFILE) +
(cmdflags & INSPECT)) != 0) ) usage(SS$_INVARG);
/* and don't allow both inspect and one of these others */
if ( (cmdflags & INSPECT) &&
( ((cmdflags & PURGE) +
(cmdflags & VERBOSE)) != 0) ) usage(SS$_INVARG);

if (sys$getjpiw(0, 0, 0, &jpi_itmlst, 0, 0, 0) != SS$_NORMAL)
{
printf("%s-f-fatal, sys$getjpiw failed\n", FACILITY);
return(SS$_ABORT);
}
else
{
char *ptr; /* username to retrieve profile info */
username[USERNAME_SIZE] = '\0'; /* NUL terminate */
ptr = strchr(username, ' '); /* find last blank */
if (ptr != NULL) *ptr = '\0'; /* replace with NUL */
}
/* since image might be installed with SYSPRV and we're gonna open a file */
if (!(privileges[0] & PRV$M_SYSPRV))
{
privileges[0] = PRV$M_SYSPRV;
privileges[1] = 0;
r0 = sys$setprv(DISABLE, &privileges, TEMPORARY, 0);
if (r0 != SS$_NORMAL) return(r0);
}

r0 = mail$user_begin(&user_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$user_begin failed\n", FACILITY);
return(r0);
}
user_get_in_itmlst[0].length = strlen(username);
r0 = mail$user_get_info(&user_context, &user_get_in_itmlst,
&user_get_out_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$user_get_info failed\n", FACILITY);
return(r0);
}

if (cmdflags & TO)
strcpy(forwarding, to);
else
{
forwarding[forwarding_len] = '\0';
if (strchr(forwarding, '"')) unquote(forwarding);
}
if (cmdflags & INSPECT)
{
if (forwarding_len)
printf("%s-i-address, default forwarding address is %s\n",
FACILITY, forwarding);
}
else
{
if (strlen(forwarding) == 0)
{
printf("%s-i-noaddress, no forwarding address set or selected\n",
FACILITY);
return(SS$_ABORT);
}
else
{
if (strchr(forwarding, '@')) smtp = 1;
if (cmdflags & VERBOSE)
printf("%s-i-forward, attempting to forward mail to %s\n",
FACILITY, forwarding);
}
}

r0 = mail$mailfile_begin(&file_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$mailfile_begin failed\n", FACILITY);
return(r0);
}
r0 = mail$mailfile_open(&file_context, &mailfile_in_itmlst,
&mailfile_out_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$mailfile_open failed", FACILITY);
if (cmdflags & MAILFILE)
printf(" for mailfile /%s/\n", mailfile);
else
printf("\n");
return(r0);
}
if (!(mailfile_indexed))
{
mail$mailfile_close(&file_context, &null_itmlst, &null_itmlst);
mail$mailfile_end(&file_context, &null_itmlst, &null_itmlst);
return(SS$_FILESTRUCT);
}
r0 = mail$mailfile_info_file(&file_context, &mailfile_info_itmlst,
&null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$mailfile_info_file failed\n", FACILITY);
return(r0);
}
r0 = mail$message_begin(&message_context, &message_in_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$message_begin failed\n", FACILITY);
return(r0);
}

if (smtp)
/* open a socket connection to LOCALHOST */
{
/* get the hostname out of our forwarding address */
stream.hostname = &localhost[0];
if (smtp_start(&stream) != SS$_NORMAL) return(SS$_ABORT);
}

/* we've already opened the mailfile so it's ok to reenable SYSPRV */
/* we'll need it to maintain the current From: field of the messages */
/* when we forward to another VMS mailbox (but not smtp mailboxes) */
if ((!(smtp)) && (privileges[0] == PRV$M_SYSPRV))
{
r0 = sys$setprv(ENABLE, &privileges, TEMPORARY, 0);
if (r0 != SS$_NORMAL) return(r0);
}

/* walk through the selected folder(s) and forward all the messages */
if (cmdflags & FOLDER)
/* is it a single folder */
{
/* if we process NEWMAIL we'll need to reset the newmail count later */
if (!(strcmp("NEWMAIL", folder))) reset_newmail_count = 1;
message_select_in_itmlst[0].bufadr = folder;
message_select_in_itmlst[0].length = strlen(folder);
r0 = mail$message_select(&message_context, &message_select_in_itmlst,
&message_select_out_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$message_select failed for folder /%s/\n",
FACILITY, folder);
return(r0);
}
if (cmdflags & INSPECT)
printf("%s-i-search, located %d messages in folder %s\n",
FACILITY, messages_selected, folder);
else
{
if (cmdflags & VERBOSE)
printf("%s-i-process, processing %d messages in folder %s\n",
FACILITY, messages_selected, folder);
for (msgvec.msg_id=1; msgvec.msg_id<messages_selected+1; msgvec.msg_id++)
{
msgvec.smtpflag = smtp;
msgvec.cmdflags = cmdflags;
r0 = forward_message_routine(&msgvec, &stream);
if (r0 == SS$_NORMAL)
forwarded_messages++;
else
{
if (r0 != MAIL$_OPENIN) return(r0);
/* can't find external mail_message file */
printf("%s-w-openin, error opening message %d in folder %s\n",
FACILITY, msgvec.msg_id, folder);
printf("-%s-w-fnf, file not found\n", FACILITY);
}
}
}
}
else
/* else process all the messages in all the folders */
{
struct node *tmp = &folder_list;
/* walk through the linked list of folders */
while (tmp->next)
{
tmp = tmp->next;
/* if we process NEWMAIL we'll need to reset the newmail count later */
if (!(strcmp("NEWMAIL", tmp->folder_name))) reset_newmail_count = 1;
message_select_in_itmlst[0].bufadr = tmp->folder_name;
message_select_in_itmlst[0].length = strlen(tmp->folder_name);
r0 = mail$message_select(&message_context, &message_select_in_itmlst,
&message_select_out_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$message_select failed for folder /%s/\n",
FACILITY, tmp->folder_name);
return(r0);
}
if (cmdflags & INSPECT)
printf("%s-i-search, located %d messages in folder %s\n",
FACILITY, messages_selected, tmp->folder_name);
else
{
if (cmdflags & VERBOSE)
printf("%s-i-process, processing %d messages in folder %s\n",
FACILITY, messages_selected, tmp->folder_name);
for (msgvec.msg_id=1; msgvec.msg_id<messages_selected+1;
msgvec.msg_id++)
{
msgvec.smtpflag = smtp;
msgvec.cmdflags = cmdflags;
r0 = forward_message_routine(&msgvec, &stream);
if (r0 == SS$_NORMAL)
forwarded_messages++;
else
{
if (r0 != MAIL$_OPENIN) return(r0);
/* can't find external mail_message file */
printf("%s-w-openin, error opening message %d in folder %s\n",
FACILITY, msgvec.msg_id, folder);
printf("%s-w-fnf, file not found\n", FACILITY);
}
}
}
}
}

if (smtp)
/* shut down the socket connection */
{
if (smtp_finish(&stream) != SS$_NORMAL) return(SS$_ABORT);
}
else
/* we're done with the privilege */
if (privileges[0] == PRV$M_SYSPRV)
{
r0 = sys$setprv(DISABLE, &privileges, TEMPORARY, 0);
if (r0 != SS$_NORMAL) return(r0);
}

r0 = mail$message_end(&message_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$message_end failed\n", FACILITY);
return(r0);
}

if ((cmdflags & PURGE) && (reset_newmail_count))
{
struct itmlst user_set_info_in_itmlst[] =
{ {0, MAIL$_USER_USERNAME, username, 0},
{sizeof(new_messages), MAIL$_USER_SET_NEW_MESSAGES,
(char *)&new_messages, 0},
{0, 0, 0, 0} };
user_set_info_in_itmlst[0].length = strlen(username);
r0 = mail$user_set_info(&user_context, &user_set_info_in_itmlst,
&null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$user_set_info failed to set new", FACILITY);
printf(" message count to /%d/ for /%s/\n", new_messages, username);
return(r0);
}
}

r0 = mail$user_end(&user_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$user_end failed\n", FACILITY);
return(r0);
}

if (cmdflags & VERBOSE)
{
if (forwarded_messages)
printf("%s-i-forwarded, %d messages forwarded\n",
FACILITY, forwarded_messages);
else
printf("%s-i-noforward, no messages selected for forwarding\n",
FACILITY);
}

if (forwarded_messages && (cmdflags & PURGE))
{
unsigned long mailfile_data_reclaim, mailfile_data_scan,
mailfile_index_reclaim, mailfile_deleted_bytes,
mailfile_total_reclaim, mailfile_messages_deleted;
struct itmlst mailfile_purge_waste_in_itmlst[] =
{ {0, MAIL$_MAILFILE_RECLAIM, 0, 0},
{0, 0, 0, 0} };
struct itmlst mailfile_purge_waste_out_itmlst[] =
{ {0, MAIL$_MAILFILE_DATA_RECLAIM, 0, 0},
{0, MAIL$_MAILFILE_DATA_SCAN, 0, 0},
{0, MAIL$_MAILFILE_INDEX_RECLAIM, 0, 0},
{0, MAIL$_MAILFILE_MESSAGES_DELETED, 0, 0},
{0, MAIL$_MAILFILE_DELETED_BYTES, 0, 0},
{0, MAIL$_MAILFILE_TOTAL_RECLAIM, 0, 0},
{0, 0, 0, 0} };
mailfile_purge_waste_out_itmlst[0].length = sizeof(mailfile_data_reclaim);
mailfile_purge_waste_out_itmlst[0].bufadr = (char *)&mailfile_data_reclaim;
mailfile_purge_waste_out_itmlst[1].length = sizeof(mailfile_data_scan);
mailfile_purge_waste_out_itmlst[1].bufadr = (char *)&mailfile_data_scan;
mailfile_purge_waste_out_itmlst[2].length = sizeof(mailfile_index_reclaim);
mailfile_purge_waste_out_itmlst[2].bufadr = (char *)&mailfile_index_reclaim;
mailfile_purge_waste_out_itmlst[3].length =
sizeof(mailfile_messages_deleted);
mailfile_purge_waste_out_itmlst[3].bufadr =
(char *)&mailfile_messages_deleted;
mailfile_purge_waste_out_itmlst[4].length = sizeof(mailfile_deleted_bytes);
mailfile_purge_waste_out_itmlst[4].bufadr = (char *)&mailfile_deleted_bytes;
mailfile_purge_waste_out_itmlst[5].length = sizeof(mailfile_total_reclaim);
mailfile_purge_waste_out_itmlst[5].bufadr = (char *)&mailfile_total_reclaim;
r0 = mail$mailfile_purge_waste(&file_context,
&mailfile_purge_waste_in_itmlst, &mailfile_purge_waste_out_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$mailfile_purge_waste failed\n", FACILITY);
return(r0);
}
if (cmdflags & VERBOSE)
printf("Cleanup Statistics\
\n Data Buckets Scanned: %d\
\n Data Buckets Reclaimed: %d\
\n Index Buckets Reclaimed: %d\
\n Total Bytes Deleted %d\
\n Total Buckets Reclaimed: %d\
\n Total Messages Deleted %d\n",
mailfile_data_scan, mailfile_data_reclaim, mailfile_index_reclaim,
mailfile_deleted_bytes, mailfile_total_reclaim, mailfile_messages_deleted);
r0 = mail$mailfile_close(&file_context, &mailfile_close_in_itmlst,
&null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$mailfile_close full_close failed\n", FACILITY);
return(r0);
}
}
else
{
r0 = mail$mailfile_close(&file_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$mailfile_close failed\n", FACILITY);
return(r0);
}
}
r0 = mail$mailfile_end(&file_context, &null_itmlst, &null_itmlst);
if (r0 != SS$_NORMAL)
{
printf("%s-f-fatal, mail$mailfile_end failed\n", FACILITY);
return(r0);
}

return(SS$_NORMAL);
}


Jim Mehlhop

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

At 04:24 PM 4/14/98 GMT, you wrote:
>In article
<c=US%a=_%p=InterVarsity_Chr%l=NSCNT1-9804...@nscnt1.ivcf.org>,
David Sironi <Sir...@IVCF.ORG> wrote:
>>My interest in the VMS Mail to MS Exchange on NT, and
>>VMS Mail to the Internet is:
>>
>>We have installed an Alpha for our Oracle server migrating from a VAX
>>cluster environment whereon UUCP runs to connect our VMS MAil to the
>>internet. From Oracle we ocassionally mail 70 to 7,000 Emails to our
>>constituents. We have been using UUCP for that. We need to keep that
>>capability, (ie., large Emails to groups of people from Oracle on
>>Alpha).
>>
>
>What operating system are you running on the "Alpha for Oracle" ?
>
>If VMS, then where did you get UUCP (and can I get it) ?

Used to be on the DECUS CD probably still is. Yup just checked it is on the
CD I got in Cinnci Decus order number VS0174.
Jim

>
>>Our main office user base use Exchange on an NT server. It has a
>>connection to the internet through a firewall router to our ISP. (Note,
>>the UUCP VAX method uses a separate dialout connection to the same ISP.)
>>
>>
>>My questions:
>>
>>How do I get to the internet from Alpha for large Email jobs?
>>
>
>Since you already have a direct connection to your ISP, use that. Innosoft
>makes mail product called PMDf that does smtp and pop (and more). Then
>you can get rid of uucp and that other dial up line.
>I'm suprised your ISP didn't recommend this solution instead of charging
>you for two different services
>
>>Can I (should I?) use the Exchange internet connection? How do I get
>>mail from Alpha to that NT Exchange server?
>>
>
>Don't need to if you use above solution..
>
>>When sending large Email jobs, what facilities are there for handling
>>the undeliverable Emails that are returned?
>>
>PMDF has facilties for handling returned mail.
>
>>Unlike the other discussion on this list service, I am not concerned
>>with moving users from VMS mail to NT Exchange. That has already
>>occurred.
>>
>>Thanks for your wise counsel!
>>
>
>
>Bruce Taube
>Info Avenue Internet
>
>

Dan Sugalski

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

At 04:52 PM 4/14/1998 -0600, Jim Mehlhop wrote:
>At 04:24 PM 4/14/98 GMT, you wrote:
>>In article
><c=US%a=_%p=InterVarsity_Chr%l=NSCNT1-9804...@nscnt1.ivcf.org>,
>David Sironi <Sir...@IVCF.ORG> wrote:
>>>My interest in the VMS Mail to MS Exchange on NT, and
>>>VMS Mail to the Internet is:
>>>
>>>We have installed an Alpha for our Oracle server migrating from a VAX
>>>cluster environment whereon UUCP runs to connect our VMS MAil to the
>>>internet. From Oracle we ocassionally mail 70 to 7,000 Emails to our
>>>constituents. We have been using UUCP for that. We need to keep that
>>>capability, (ie., large Emails to groups of people from Oracle on
>>>Alpha).
>>>
>>
>>What operating system are you running on the "Alpha for Oracle" ?
>>
>>If VMS, then where did you get UUCP (and can I get it) ?
>
>Used to be on the DECUS CD probably still is. Yup just checked it is on the
>CD I got in Cinnci Decus order number VS0174.

And it works on Alphas? Cool.

Jim Mehlhop

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to

At 04:06 PM 4/14/98 -0700, Dan Sugalski wrote:
>At 04:52 PM 4/14/1998 -0600, Jim Mehlhop wrote:
>>At 04:24 PM 4/14/98 GMT, you wrote:
>>>In article
>><c=US%a=_%p=InterVarsity_Chr%l=NSCNT1-9804...@nscnt1.ivcf.org>,
>>David Sironi <Sir...@IVCF.ORG> wrote:
>>>>My interest in the VMS Mail to MS Exchange on NT, and
>>>>VMS Mail to the Internet is:
>>>>
>>>>We have installed an Alpha for our Oracle server migrating from a VAX
>>>>cluster environment whereon UUCP runs to connect our VMS MAil to the
>>>>internet. From Oracle we ocassionally mail 70 to 7,000 Emails to our
>>>>constituents. We have been using UUCP for that. We need to keep that
>>>>capability, (ie., large Emails to groups of people from Oracle on
>>>>Alpha).
>>>>
>>>
>>>What operating system are you running on the "Alpha for Oracle" ?
>>>
>>>If VMS, then where did you get UUCP (and can I get it) ?
>>
>>Used to be on the DECUS CD probably still is. Yup just checked it is on the
>>CD I got in Cinnci Decus order number VS0174.
>
>And it works on Alphas? Cool.

looks like it, BUT I didn't try it since I have my choice of multinet or
tcpware. :-)

Jim

>
> Dan
>
>---------------------------------------------"it's like this"--------------
>Dan Sugalski (541) 737-3346 even samurai
>SysAdmin have teddy bears
>Oregon University System and even the teddy bears
>suga...@ous.edu get drunk
>
>

Mr. X

unread,
Apr 15, 1998, 3:00:00 AM4/15/98
to

Howdy! = My 2 cents:

I'll have to agree with Jim here -

Having extensive experience with both NT exchange (and the smtp
add-on, etc...) as well as extensive Multinet/OVMS experience, the
reliability of the VMS/Multinet solution as well as the performance
(and I feel I'm being nice) greatly outweigh the exchange solution -
if your'e trashing the VAX anyway, use it as a mail server! All your
clients can pop to their hearts content with whichever client they
choose...

I know of several sites that have done just that - Migrated away from
VMS machines with the exceptions od DNS serving, and mail
applications. Makes sense, as these are the "Mission critical"
internet applications for so many businesses...

...oops - I think that was four cents...

(opinion, responsibility, bla bla bla)

Minos Dounias

Ed Wilts

unread,
Apr 17, 1998, 3:00:00 AM4/17/98
to

If Eudora does it but Outlook doesn't, you can start with a Eudora download
and then convert from Eudora to Outlook. It's kludgy but might work for
you.

FWIW, I've had no problems with downloading messages via POP into Outlook 97
and 98 and preserving the original dates.

.../Ed

--

Ed Wilts
Mounds View, MN
mailto:ewi...@winternet.com

Miles Oliver wrote in message
<99E285AEE42AD1118E6...@npr-01-msg.npr.org>...


>Pop indeed does work but when converting to MS Exchange/Outlook I have run
>into a snag,
>
>Exchange will mark the messages as received on the date of conversion,
>losing the actual received date.
>
>Using Eudora and pulling the messages via Pop the actual receive dates are
>retained.
>
>Im not finding much information on a workaround.
>

>Miles D. Oliver - POSTMASTER Tech. Operations Manager
>National Public Radio W. +1-202-414-2989
>635 Massachusetts Ave NW FAX: +1-202-414-3051
>Washington DC. 20001 Internet: mol...@npr.org
>http://www.npr.org/
>http://www.geocities.com/MotorCity/1328
>http://www.off-road.com/~occweb
>
>
>
>-----Original Message-----
>From: John Macallister [mailto:J.Macal...@physics.ox.ac.uk]
>Sent: Tuesday, April 14, 1998 6:21 AM
>To: Info-Multinet (E-mail)
>Cc: Myself (E-mail)

>Subject: FW: VMS to NT mail converter
>
>
>The Mail Integration Tool requires PATHWORKS at the VMS end.
>
>It is possible, of course, to move mail from VMS to NT using POP but,
>for users with many folders this can be tedious. The Mail Integration
>Tool provides the possibility of moving mail in a single, simple,
>point-click-drag operation.
>

Javier Henderson

unread,
Apr 17, 1998, 3:00:00 AM4/17/98
to

> >Pop indeed does work but when converting to MS Exchange/Outlook I have run
> >into a snag,
> >
> >Exchange will mark the messages as received on the date of conversion,
> >losing the actual received date.
> >
> >Using Eudora and pulling the messages via Pop the actual receive dates are
> >retained.
> >
> >Im not finding much information on a workaround.

I'm not sure if this is related to the problem you're seeing
or not, but I do recall working a case back when I was still
supporting MultiNet where I saw Outlook messing up the date because it
wasn't parsing the Date: RFC822 header properly. I don't remember the
specifics, but it wouldn't get confused if the GMT offset wasn't
there.

-jav

0 new messages