Operating System - OpenVMS
1753321 Members
6202 Online
108792 Solutions
New Discussion юеВ

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

 
SOLVED
Go to solution
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