Skip to main content

[archive] email attachments

  • June 11, 2004
  • 15 replies
  • 0 views

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian

15 replies

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
A standard e-mail consists only of ASCII characters.

To add binary attachments, you need to use MIME (Multipurpose Internet Mail Extensions). MIME is a standard that describes how to specify the attachments in the body of the e-mail.

The attachment itself can be in various formats. For example, if you want to send an e-mail formatted using HTML, it is really sent as a MIME attachment, specifying that it is in the HTML format.

To send binary files, you have to "encode" the files so that the file can be represented entirely as ASCII text. One of the most common ways to do this is base64.

See this page for a brief overview:

http://www.dpo.uab.edu/Email/attach.html

See the RFC for a more detailed explanation:

http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc1521.html

As for encoding a binary file into base64 in Cobol, well... I've never seen any example code doing that. But there are third party ActiveX and DLL components that will do all of the e-mail handling for you, including attachments.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Thanks for providing this useful information and the links.

As for the encoding of the attachments, I would suggest that one may use one of the freeware uuencode/uudecode programs. I know these are available on most platforms.

It should also be possible to get a hold of example code for this, of course in C, but still. Could have been an interesting project, to create an uu(en)(de)code parser in COBOL.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Hello gisle,

i've written a subroutine to send emails, based on the sendmail.cbl. This subrotuine can compose and send a email including up to three attachment-files. The attatchments will be encoded with base64. The whole subroutine is written in COBOL. Detailed description is available.

Originally posted by gforseth
Thanks for providing this useful information and the links.

As for the encoding of the attachments, I would suggest that one may use one of the freeware uuencode/uudecode programs. I know these are available on most platforms.

It should also be possible to get a hold of example code for this, of course in C, but still. Could have been an interesting project, to create an uu(en)(de)code parser in COBOL.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Firstly I would like to take this opportunity to thank JOED for his information above.

We have managed to work out how to send binary attachments from our system using the original code within sendmail.cbl and also the information posted by JOED.

However, to encrypt binary files to mime-64 I was going to use a freeware product called "uudeview" which we were going to call using C$SYSTEM.

The problem with that though is we need to compile it on different Unix platforms which I have not yet done as our customer needs it on a windows platform.

Therefore if we can do it all in COBOL it would be a much better solution for us.

Theefore, please, please, please Peter can you provide us your example source code that converts the binary file into MIME-64 format.

Regards
Brian Douglas
bd@interchangegroup.com

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Hi This is also exactly what We are also looking, the sendmail
works very well, if it could do an attachment it would be wonderfull, could one of you kind people please post an example

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Ditto - would be keen to see Peter's example cose for sending emails with attachments as I will be wanring to do this myself very soon.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Hi,

cou can find the example for sending Emails with attachments on the following webpage:

http://www.kiss-personal.de/cobolmail.htm

on this page you will find the sample source code and the lecture hold on the 15th AcuCorp Developer Conference in Munich.
(language: german). A short description in English is also available on this website.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
There's a product at marshallsoft.com that will allow you to incorporate every Email feature into a cobol application. It's inexpensive and very easy to use. Saved me a lot of hassles.

Regards

Vins Nash

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Hi Fans,

I've tested this product from Marshallsoft.com. This product is not freeware like the cobol-program descrobed on my website.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Hey peter, just downloaded and tested the program you said!
Great work!! I will try to create my own now based on that!
You really saved me (and i am sure many others) a lot of frustration.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Peter - looked at the website you mentioned but seems to have acubench sample - as I do not user this it is difficult to get to look at the sample source. Any chance of just a simple listing of the generated cobol program?
Keith

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
I've inserted a new file named testmail.complete.cbl in the zipfile. This file is the complete code of the Program, which displays the screen and call the subroutine winmail.cbl.

The zip-file has been updated on the webpage:

http://www.kiss-personal.de/cobolmail

at December, 8th 2005.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Peter have you solved the multiple recipients issue?
I currently check my To entry field in the mail form
and if it contains commas i split it up and call winbmail multiple times. Im afraid this is going to slow things down.

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Hi,

this feature will be realized in the next release of the module winbmail. It is planned for March 2006

[Migrated content. Thread originally posted on 11 June 2004]

Hello Everyone,

I have been looking into how we can code our COBOL system to send emails. I have looked at the various options and decided that the C$SOCKET solution that links directly to the SMTP port (25) is the best solution. (See example program sendmail.cbl). Reason being we need to run our system on both windows and unix platforms.

I have got this program working in our test environment and we will encorporate the code into our programs accordingly.

However, it does not show how we can email binary attachments such as word or pdf documents.

I am lead to believe that the binary files will need to be encoded into ASCII format and sent accordingly. Is this the case? If so how is it done and what is the syntax required to send it? Has anyone else managed to send attachments at all?

Please Help me as I am now stuck on where we go from here.

Regards
Brian
Did anyone get the issue of multiple receipts to work with out calling the winbmail with each "to:"?

Maybe I have an old version of WINBMAIL, but we still have the issue of not being able to add multiple "to:" values with commas.

Thanks