Operating System - OpenVMS
1827893 Members
1722 Online
109969 Solutions
New Discussion

Sending Mails from OpenVMS with Attachments (.ZIPS)

 
SOLVED
Go to solution

Sending Mails from OpenVMS with Attachments (.ZIPS)

Hello,
ist it possible that i can sending Mails over OpenVMS with attachments?
Im looking for examples who i can send ZIP-Files or Binary Files etc. to another Mailsystems.

Thanks for your Tips

17 REPLIES 17
Volker Halle
Honored Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Manfred,

yes - you can use the MIME utility to do compose messages with attachments and then send the resulting file to other mail systems.

Example:

$ MIME
MIME> NEW/NOEDIT x.x
MIME> ADD/BIN abc.zip
MIME> SAVE

Then send file x.x to your other mail system with

$ MAIL x.x "user@mail.domain"/SUBJ="Test"

Volker.
Martin Vorlaender
Honored Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

There's the MIME utility to compose MIME mails, see http://h71000.www7.hp.com/doc/731FINAL/6489/6489pro_014.html#mice

HTH,
Martin
Ken Robinson
Valued Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

I'm not sure where I found the following code:

$ set noon
$! set nover
$ ext = f$edi(f$par(p1,,,"type"),"lowercase")
$ fn = f$edi(f$par(p1,,,"name"),"lowercase")
$ if ext .eqs. ".com"
$ then
$ zip 'fn'.zip 'p1'
$ uuencode 'fn'.zip 'p1'_uu
$ else
$ uuencode 'p1' 'p1'_uu
$ endif
$ mail/sub="''p1'" 'p1'_uu "''p2'"

As you can see it uses uuencode to send files.

Ken
Craig A Berry
Honored Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

In addition to MIME, there is another utility called MPACK that ought to do the trick. Personally I use Perl with the MIME::Lite module; read about it here:

http://www.akadia.com/services/email_attachments_using_perl.html
Petr Spisek
Regular Advisor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Hi,
you can use classic VMS mail:
$ uuencode := $ tcpip$uuencode
$ uuencode myfile.zip myfile.dat
$ mail myfile.dat "email-adres@something.com" /subject="Mail with attachment"

Petr
(You could set $uudecode := $ tcpip$uudecode for decoding, but it doesn't needed for this)
Robert Atkinson
Respected Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Is there any way to get text into the message body as well?

Rob.
Petr Spisek
Regular Advisor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Rob,
mail mytextfile.txt "email@addr.com"

Petr
Volker Halle
Honored Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Rob,

with MIME you can also put text into the message body before adding your attachements:

$ MIME
MIME> NEW/EDIT x.x
...
MIME> ADD/BIN abc.zip
MIME> SAVE

Volker.
Robert Atkinson
Respected Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Was thinking more along the lines of an automated procedure.

We wrote a VB program some time ago that is capable of taking a VMS created file and attaching it to an email using MS Oulook, then sending it off to a list of users.

This relies on Pathworks, Exchange and a PC logged on.

If I can transfer the whole thing onto the Alpha, but still have it run unassisted in batch, it will simplify the whole process.

Rob.
Robert Atkinson
Respected Contributor
Solution

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

OK, think I've got something workable now.

I can dynamically create a simple header file like this :-

ALPHA_ROB$$ typ robmime.tmp
Mime-version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Message-ID:

This is a test message
----------------------

ALPHA_ROB$$


Then use a script like this to send the email :-

$ set veri
$ cop robmime.tmp robmail.tmp
$ mime == "$sys$system:mime.exe"
$ mime
open robmail.tmp /draft
add rob.zip
add [live.txt]test.txt
save
$ mail robmail.tmp "ratkinson@tbsltd.co.uk" /subject="test - ''F$time()'"
$ exit

One last thing. Any idea how I set the 'from' address, so that all emails come back to our Helpdesk or similar?

Rob.
Martin Vorlaender
Honored Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Rob,

TCP/IP Services has this TCPIP$SFF (Send from file) utility. If you have constructed a complete mail file (including the mail headers) you can use it to feed that mail to TCP/IP Services' SMTP. See http://h71000.www7.hp.com/doc/732FINAL/6525/6525pro_016.html#sff_sec

HTH,
Martin

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Hello VOlker,
if i use the following Command, then i become this Error message:

MIME> new/edit
_Input Message File Name: test.txt
%MIME-E-ERROR, error: Error spawning edit command
status = 00038008
MIME

what is wrong

Volker Halle
Honored Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Manfred,

MIME tries to use a default editor.
Please check MIME> HELP NEW/EDIT for the various possibilities to define a default editor.

I normally have a global symbol ED*IT:==EDIT/TPU - if I delete this symbol, I get the same error message as you.

Volker.
Lokesh_2
Esteemed Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Hi Manfred,

The /EDIT qualifier expects a quoted string. So you need not specify the
qualifier unless you want a specific editor or /NOEDIT session.

/EDIT="Editor_command_string-or-_file_here" ! for example:

MIME> NEW /EDIT="EDIT/TPU" !. . .is the proper usage

MIME> NEW /EDIT="EDIT/EDT" ! or this


HTH,
Thanks & regards,
Lokesh
What would you do with your life if you knew you could not fail?
Eric vanSpronsen
New Member

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Hello!

I had a similar challenge: a vms-program produced an xml-file which should be sent to an e-mail addresslist. Due to the size of the xml-file which would not be accepted by e-mail servers, I had to zip it first under OpenVMS 7.3, and send the compressed file as a bcc to each address using mime. The tcpip protocol stack: TCPware v 5.6.

The difficult parts where producing the mimefile within a batch and sending the mimemail with a differect return address e-mail alias via the tcpware stack using the SMTP_USER_HEADERS logical.

This forum provided pieces of the puzzle to finaly succeed!

$!
$ DATE = F$EXTRACT(0,11,F$TIME())
$ DAY = F$EXTRACT(0,2,DATE)
$ MONTH = F$EXTRACT(3,3,DATE)
$ YEAR = F$EXTRACT(9,2,DATE)
$ DATUM = YEAR+MONTH+DAY
$!
$! Running the program that produces the xml outputfile pricelist.xml:
$ run prog:xmlmaker.exe
$!
$! Zipping the output
$ zip :== "$prog:zip.exe"
$ ZipName = "output:pricelist_''DATUM'.zip"
$ delete 'ZipName';* /log
$ zip 'ZipName' pricelist.xml
$!
$! Make a mime file out of a standard mime-template containing the plain
$! Text of the mail.
$ MimeName = "output:pricelist_''DATUM'.mime"
$ copy output:pricelist_template.mime 'MimeName'
$ open /write BSTOUT output:mimecmd.com
$ write bstout "$ mime :== ""$sys$system:mime.exe"" "
$ write bstout "$ mime
$ write bstout "open /draft ''MimeName' "
$ write bstout "add /bin ''ZipName' "
$ write bstout "save "
$ write bstout "exit "
$ close bstout
$!
$! Now executing the mime-commandfileâ ¦
$!
$ @output:mimecmd.com
$!
$! The MimeFile is ready. The MimeHeader in the file should now be imported
$! In the TCPWARE logical TCPWARE_SMTP_USER_HEADERS
$!
$ open /read /error=einde BSTIN 'MimeName'
$ read /err=einde BSTIN User_Header1
$ If F$Locate("Mime",User_Header1).nes.F$Length(User_Header1)
$ then
$ read /err=einde BSTIN User_Header2
$ QuotePos = f$locate("""",User_Header2)
$ User_Header2a=F$extract(0,QuotePos,User_Header2)
$ User_Header2b=F$extract(QuotePos+1,F$length(User_header2),User_Header2)
$ QuotePos2 = f$locate("""",User_Header2b)
$ User_Header2c=F$extract(0,QuotePos2,User_Header2b)
$ read /err=einde BSTIN User_Header3
$ read /err=einde BSTIN User_Header4
$ define/nolog TCPWARE_SMTP_USER_HEADERS -
"''User_Header1' ", -
"''User_Header2a' ""''User_Header2c'"" ",-
"''User_Header3' ", -
"Full-Name: ""IT Department"" ",-
"Reply-To: ""IT@Hotmail.com"" ",-
"Sender: ""It Department"" ",-
"''User_Header4' "
$ else
$ Write sys$output "''MimeName' is not a Mime-file!"
$ goto erroreinde
$ endif
$!
$! Now use standard VMS mail to send the mimemail to all e-mail addresses
$! In the file receivers.dis
$!
$ MAIL 'MimeName' "@receivers.dis" /subject="Updated Pricelist"
$ goto einde
$!
$ERROREINDE:
$ Write sys$output "mimemail error!"
$EINDE:
$ close BSTIN

This is not the final version, in which a loop reads all the addresses in the receivers.dis file and mails the mimefile to each address, but that part is not intresting.

Thanks to all posters on this forum for providing the pieces of the puzzle!
Hope that this script will help others.

Regards,
Eric van Spronsen
The Netherlands
John Gillings
Honored Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

Manfred,

There's an OpenVMS utility called SMTP SFF (Send From File). Here's the description:

"SMTP SFF allows you to create a mail message in a file and send it to the SMTP mailer to be delivered with headers you specify. Using this feature, you can create automated tools that compose and send mail messages. It is also useful for forwarding non-text files (MIME), because it prevents the mailer from encapsulating the MIME and SMTP headers in the body of a new mail message. Thus, SMTP can function like the redirect command on your personal computer, which simply takes the message as is, without encapsulating it in another message, and sends it to the person you name. "

Use the MIME utility as described above to create the file, add SFF headers and send it from DCL using TCPIP$SYSTEM:TCPIP$SMTP_SFF.EXE, or from a program by calling TCPIP$SMTP_SEND_FROM_FILE (link against SYS$SHARE:TCPIP$SMTP_MAILSHR.EXE/SHARE).

For full details see docs in "HP TCP/IP Services for OpenVMS
User's Guide", Section 5.9

A crucible of informative mistakes
Oswald Knoppers_1
Valued Contributor

Re: Sending Mails from OpenVMS with Attachments (.ZIPS)

You can also use the mailsymbiont from the freeware CD. It handles binary attachments and can also send text in the body in the mail.

Newest version can be found on:

http://oswald.knoppers.googlepages.com/mailsymhome