Skip to main content

[archive] Sending emails with attachments

  • February 11, 2009
  • 16 replies
  • 0 views

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl

16 replies

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
I assume winbmail.cbl does attachments as you say you have tried it and email with attachments seems the scope of your email?

Assuming this to be the case, I presume it would be ideal if that works, then I have another question, have you tried this outside of Citrix? Does it hang on a paragraph regardless of Citrix, if it always hang on that paragraph I'd suggest you look into this on a local machine, simplifying the reproducing environment.

It would also be good to know whether it only hang with an attachment or if it would also hang for a plain email.

In any case, try run a trace, this might reveal what is happening when it hangs, and how far the execution goes. Knowing how far the program gets and where it halts is fundamental to find a solution.

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
Hello, and thank you for your answer.

When i try to send attachments using the code from winbmail.cbl, the hang occurs in the paragraph where the program try to read answer (using the command ASG-READ) from the socket, after sending data. This hang occurs first when trying to send data-string: "CRLFCRLF.CRLFCRLF". Sending the data returns correct, but when trying to read from the socket afterwords, the system hangs. After this, the hang occurs several times when trying to read answers from the socket.
We never managed (so far) to sende emails with winbmail.cbl, not even without attachments.

My colleque wrote a test-program earlier using the same socket, that managed to send emails without attachement. I now have copied some of the code from winbmail.cbl into this program, to try sending attachments. We have programmed around the hang problem from the ASG-READ command, and sending data seems to work correct. BUT when we come to the close command (ASG-CLOSE), the system hang there. When we drop attachment, this works correct and the email (without attachment) is sent.

I will try to set up trace files to se if I can read more out of this. I am not sure that we are allowed to set up an local email-system, but I will check if I can test this.

Best regards
Dagl

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
We have a variation of winbmail.
This works for us internally when ran via thinclient on a unix server.
If we try to run within windows either with thinclient or local runtime it also hangs.
I can't remember exactly where it hangs, but I do know it hangs on a read of the status back from c$socket.

We have several users using these programs in windows thinclient without problem though.

Never really taken it further, so long as it works for customers then its not causing us problems.
I might try and put a trace on at sometime and ship it off to support.

Shaun

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
If this is correct, we are lost in space. Since we does not run thinclient, and we cannot force all of our customers to run this.

Meanwhile, we are looking at other possibilities. My colleque has tried to program against cdosys.dll, using the CDO object. But, he has ran into problems with configurating the object, not being able to set correct configuration values. Or not able to set the values at all.

Has anyone tried to use this object?

Regards
Dagl

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
If you can, do a trace and log with your support centre - assuming you've got a contract of course.

c$socket does work - that I'm sure of.
We have at least 3 sites who use our software to email stuff and they are using windows. They also have test environments which use local wrun32 also.

Shaun

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
i solved using adodb for configuration
...
copy "adodb.def".
...
01 cdoSendUsingMethod PIC X(80) VALUE
"schemas.microsoft.com/.../sendusing".
01 cdoSendUserName PIC X(80) VALUE
"schemas.microsoft.com/.../sendusername"
.
01 cdoSMTPServer PIC X(80) VALUE
"schemas.microsoft.com/.../smtpserver".
...
77 OBJ-MAIL HANDLE OF @Message.
77 OBJ-ATT HANDLE OF @IBodyParts.
77 OBJ-CONF HANDLE OF @IConfiguration.
77 OBJ-FIELDS HANDLE OF @Fields.
77 OBJ-FIELD HANDLE OF @Field.

...
CREATE @Message OF CDO HANDLE IN OBJ-MAIL.
MODIFY OBJ-MAIL, @TO = MAIL-TO.
MODIFY OBJ-MAIL, @FROM = MAIL-FROM.
MODIFY OBJ-MAIL, @SUBJECT = MAIL-SUBJECT.
MODIFY OBJ-MAIL, @TEXTBODY = MAIL-BODY.
MODIFY OBJ-MAIL, @AddAttachment( WFILENAME1 ) GIVING OBJ-ATT.
IF OBJ-CONF = NULL PERFORM NEW-CONFIGURATION.
MODIFY OBJ-MAIL, @Configuration = OBJ-CONF.
MODIFY OBJ-MAIL, @Send().
...
NEW-CONFIGURATION.
CREATE @Configuration OF CDO HANDLE IN OBJ-CONF.
INQUIRE OBJ-CONF, @Fields IN OBJ-FIELDS.
INQUIRE OBJ-FIELDS Item(cdoSendUsingMethod) IN OBJ-FIELD.
MODIFY OBJ-FIELD @Value = 2.
* Name or IP of Remote SMTP Server
INQUIRE OBJ-FIELDS Item(cdoSMTPServer) IN OBJ-FIELD.
MODIFY OBJ-FIELD @Value = W-cdoSMTPServer
...

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
Thank you all for answers

ffrasson:
I see that you use a adodb.def file, probably a definition of msadodb.dll of some version. I don`t se any cdo-definition in your example, but I think there must be one since you use CDO to create the objects?

I see that you use CDO to create the object and configuration. Thus, you must get the properties of CDO along?
My problem is that in my definition of CDO, there is no @Fields class. Therefore, I cannot extract, and being able to set the fields for configuration.
In ADODB, there is at @Fields class. But, since the object of configuration is created from CDO, I cant use the @Fields-class from ADODB. Correct?

What am I missing here?

My problem is that I cannot extract the fields of configuration into separate field, thus I cannot set the configuration values correct. I feel that I am very close, but what is the detail I am missing?
Is there a way to set the configuration properties without using the @Fields -class?

Regards Dagl

Edit: The problem is solved, se the next post

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
Hello again.

ffrasson:
I was a bit to early with my last post. After I had posted it, I copied all your variables and code without any modifications, and then I got no compilation errors.

But, I still did not get it right. I got an error when sending the mail, saying that the configuration values is not correct. That was the same error I got when I tried without setting configuration values at all.

Trying from VB with the same object, I managed to send emails finaly. But, there I had to invoke a .Update - method on the fields to get it to work. After a while, I managed to invoke this method also from my COBOL program, and then the mail was sent. With attachments!

Thank you for your answer and your program example. It helped me a lot. The only thing was the update-method that I had to add.

Regards Dagl

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
Dag, can you post me the winbmail that fails for you and I will see if I can reproduce and if so, try to figure out what the problem is. No promises on time frame for response though.

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
gforseth: Thank you for the help. I will post you the winbmail-version that does not work for us, so you can see if you can trap the error. Now we have come very far with CDO, so I think we will go on this path a bit further meanwhile.

But, i do get a problem with CDO. If the @To - Adress is wrong, the system crash with a message; "The server rejected one or more receipient adresses. The server response was: 550 5.1.1 User unknown"

How can I trap this so I can give the user a error message instead of crashing the system?

Regards Dagl

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl

       DECLARATIVES.
Object-exception-handling Section.
           Use After Exception On Object.
       Object-exception-handler.
            Call "c$excepinfo" Using Error-info, Err-source,
                Err-description, Err-help-file,
                Err-help-context.
            Evaluate True
                When Facility-acu
                    Evaluate True
                        When Acu-e-unexpected
                            Perform Object-exception-display
                            Stop Run
      *                  When Other
      *                      Perform Object-exception-display
                    End-evaluate
                When Facility-active-x
      *              Evaluate Error-info-code
      *                When Other
                            Perform Object-exception-display
                            Exit Program
                            Stop Run
      *              End-evaluate
                End-evaluate.
       END DECLARATIVES.

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
I hate to revive an dead thread but I need to know if anyone has a copy of winbmail.cbl? I would like to get the source for this so I can manipulate it to work for us a little cleaner.

Thanks for any help.

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
found it in my sample-archive:

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
Thanks Frosti....now to get it to do what I want!!!

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
http://www.marshallsoft.com very inexpensive, works with cobol, VB etc. It does the whole 9 yards

[Migrated content. Thread originally posted on 10 February 2009]

Hi

I know there is a lot of threads regarding this theme, but I have not found any direct answer to my questions yet.

We want to send emails from our COBOL program, with attachements. We have our own email system on a Citrix terminal, and some of our customers also have this setting. Other of our customers have their email system locally installed, or on a server in a net.

We have looked at the code examples for using MS Outlook (MSMAPI), and the code examples for using "c$socket". Using MSMAPI, we does not get through to our own email system on Citrix, and using "c$socket" we are not able to send attachments. For the time being, we are researching the possibility with "c$socket". We have downloaded the program winbmail.cbl and have compiled this, but have not yet been able to send attachments. The program is hanging on some paragraph, and we have not yet found the solution to this.

I simply ask what direction is the best for us? We need to communicate with email system locally, and residing on Citrix.

Best regards
Dagl
Alex do you have a sample project where you call and use the Marshallsoft dll that you would not mind sharing?

Thanks