Skip to main content

[archive] Attaching docs to email using SMTP

  • July 24, 2008
  • 7 replies
  • 0 views

[Migrated content. Thread originally posted on 23 July 2008]

I have looked at the forums and have tried their suggestions by I cannot send an email with an attachment, from my program.

Here is the code I have

In Working Storage

01 EMAIL-HANDLE USAGE HANDLE OF SMTP. (The DEF file for the SMTP object is compiled into my program)
01 ATTACH-HANDLE USAGE HANDLE OF Attachment.


Then in the code I am modifying the EMAIL-HANDLE with the normal email info, address, subject, message, importance, etc. Then before the code

MODIFY EMAIL-HANDLE
@RaiseError(0),
@SendEmail().

I have

INQUIRE EMAIL-HANDLE @Attachments IN ATTACH-HANDLE.
MODIFY ATTACH-HANDLE
@AttachmentName = ATTACH-NAME (which is the path and file name of the document that I want to attach to the email)

The email sends, but there is no attachment. I have tried different properties, methods and events, but I cannot seem to get the file to attach to the email. (I have tried using @FilePath, @Attachments. There is no @Add in the Def file, so I can use that)

Any help would be appreciated.

7 replies

[Migrated content. Thread originally posted on 23 July 2008]

I have looked at the forums and have tried their suggestions by I cannot send an email with an attachment, from my program.

Here is the code I have

In Working Storage

01 EMAIL-HANDLE USAGE HANDLE OF SMTP. (The DEF file for the SMTP object is compiled into my program)
01 ATTACH-HANDLE USAGE HANDLE OF Attachment.


Then in the code I am modifying the EMAIL-HANDLE with the normal email info, address, subject, message, importance, etc. Then before the code

MODIFY EMAIL-HANDLE
@RaiseError(0),
@SendEmail().

I have

INQUIRE EMAIL-HANDLE @Attachments IN ATTACH-HANDLE.
MODIFY ATTACH-HANDLE
@AttachmentName = ATTACH-NAME (which is the path and file name of the document that I want to attach to the email)

The email sends, but there is no attachment. I have tried different properties, methods and events, but I cannot seem to get the file to attach to the email. (I have tried using @FilePath, @Attachments. There is no @Add in the Def file, so I can use that)

Any help would be appreciated.
@Add is what you need to use.

Don't know what version of the .def file you have.


           77  ATTACH-HANDLE         HANDLE OF ATTACHMENTS.

           CREATE APPLICATION OF OUTLOOK HANDLE IN OUTLOOK-HANDLE
           MODIFY OUTLOOK-HANDLE, CREATEITEM (OLMAILITEM) GIVING
                                                    MAIL-HANDLE
           MODIFY MAIL-HANDLE    @SUBJECT "Purchase Order"
           MODIFY MAIL-HANDLE    @TO      WS-EMAIL-ADDRESS
           INQUIRE MAIL-HANDLE ATTACHMENTS IN ATTACH-HANDLE
           MODIFY  ATTACH-HANDLE @ADD(WS-EMAIL-ATTACHMENT,
                           OLBYVALUE, 1, "SEE ATTACHMENT")
           MODIFY MAIL-HANDLE @SEND()
           DESTROY MAIL-HANDLE
           DELETE FILE EMAIL-FILE


.def file used here is also attached.

[Migrated content. Thread originally posted on 23 July 2008]

I have looked at the forums and have tried their suggestions by I cannot send an email with an attachment, from my program.

Here is the code I have

In Working Storage

01 EMAIL-HANDLE USAGE HANDLE OF SMTP. (The DEF file for the SMTP object is compiled into my program)
01 ATTACH-HANDLE USAGE HANDLE OF Attachment.


Then in the code I am modifying the EMAIL-HANDLE with the normal email info, address, subject, message, importance, etc. Then before the code

MODIFY EMAIL-HANDLE
@RaiseError(0),
@SendEmail().

I have

INQUIRE EMAIL-HANDLE @Attachments IN ATTACH-HANDLE.
MODIFY ATTACH-HANDLE
@AttachmentName = ATTACH-NAME (which is the path and file name of the document that I want to attach to the email)

The email sends, but there is no attachment. I have tried different properties, methods and events, but I cannot seem to get the file to attach to the email. (I have tried using @FilePath, @Attachments. There is no @Add in the Def file, so I can use that)

Any help would be appreciated.
Thanks, Shaun, but I can't use the outlook object, I need the SMTP object that we use for other programs and that object does not have an Add.

[Migrated content. Thread originally posted on 23 July 2008]

I have looked at the forums and have tried their suggestions by I cannot send an email with an attachment, from my program.

Here is the code I have

In Working Storage

01 EMAIL-HANDLE USAGE HANDLE OF SMTP. (The DEF file for the SMTP object is compiled into my program)
01 ATTACH-HANDLE USAGE HANDLE OF Attachment.


Then in the code I am modifying the EMAIL-HANDLE with the normal email info, address, subject, message, importance, etc. Then before the code

MODIFY EMAIL-HANDLE
@RaiseError(0),
@SendEmail().

I have

INQUIRE EMAIL-HANDLE @Attachments IN ATTACH-HANDLE.
MODIFY ATTACH-HANDLE
@AttachmentName = ATTACH-NAME (which is the path and file name of the document that I want to attach to the email)

The email sends, but there is no attachment. I have tried different properties, methods and events, but I cannot seem to get the file to attach to the email. (I have tried using @FilePath, @Attachments. There is no @Add in the Def file, so I can use that)

Any help would be appreciated.
We are using a product from Marshallsoft that works great, they give you the source code for cobol, and is very inexpensive around 115.00 royality free. (http://www.marshallsoft.com)

Hope this helps.

[Migrated content. Thread originally posted on 23 July 2008]

I have looked at the forums and have tried their suggestions by I cannot send an email with an attachment, from my program.

Here is the code I have

In Working Storage

01 EMAIL-HANDLE USAGE HANDLE OF SMTP. (The DEF file for the SMTP object is compiled into my program)
01 ATTACH-HANDLE USAGE HANDLE OF Attachment.


Then in the code I am modifying the EMAIL-HANDLE with the normal email info, address, subject, message, importance, etc. Then before the code

MODIFY EMAIL-HANDLE
@RaiseError(0),
@SendEmail().

I have

INQUIRE EMAIL-HANDLE @Attachments IN ATTACH-HANDLE.
MODIFY ATTACH-HANDLE
@AttachmentName = ATTACH-NAME (which is the path and file name of the document that I want to attach to the email)

The email sends, but there is no attachment. I have tried different properties, methods and events, but I cannot seem to get the file to attach to the email. (I have tried using @FilePath, @Attachments. There is no @Add in the Def file, so I can use that)

Any help would be appreciated.
We are using a product from Marshallsoft that works great, they give you the source code for cobol, and is very inexpensive around 115.00 royality free. (http://www.marshallsoft.com)

Hope this helps.

[Migrated content. Thread originally posted on 23 July 2008]

I have looked at the forums and have tried their suggestions by I cannot send an email with an attachment, from my program.

Here is the code I have

In Working Storage

01 EMAIL-HANDLE USAGE HANDLE OF SMTP. (The DEF file for the SMTP object is compiled into my program)
01 ATTACH-HANDLE USAGE HANDLE OF Attachment.


Then in the code I am modifying the EMAIL-HANDLE with the normal email info, address, subject, message, importance, etc. Then before the code

MODIFY EMAIL-HANDLE
@RaiseError(0),
@SendEmail().

I have

INQUIRE EMAIL-HANDLE @Attachments IN ATTACH-HANDLE.
MODIFY ATTACH-HANDLE
@AttachmentName = ATTACH-NAME (which is the path and file name of the document that I want to attach to the email)

The email sends, but there is no attachment. I have tried different properties, methods and events, but I cannot seem to get the file to attach to the email. (I have tried using @FilePath, @Attachments. There is no @Add in the Def file, so I can use that)

Any help would be appreciated.
There is a program originally posted on the forum called WINBMAIL.CBL that send emails with attachments. I have used this with some changes for our own system and it works perfectly. Try to find the original sample on the forums, else I will send you what we have for this.
Keith

[Migrated content. Thread originally posted on 23 July 2008]

I have looked at the forums and have tried their suggestions by I cannot send an email with an attachment, from my program.

Here is the code I have

In Working Storage

01 EMAIL-HANDLE USAGE HANDLE OF SMTP. (The DEF file for the SMTP object is compiled into my program)
01 ATTACH-HANDLE USAGE HANDLE OF Attachment.


Then in the code I am modifying the EMAIL-HANDLE with the normal email info, address, subject, message, importance, etc. Then before the code

MODIFY EMAIL-HANDLE
@RaiseError(0),
@SendEmail().

I have

INQUIRE EMAIL-HANDLE @Attachments IN ATTACH-HANDLE.
MODIFY ATTACH-HANDLE
@AttachmentName = ATTACH-NAME (which is the path and file name of the document that I want to attach to the email)

The email sends, but there is no attachment. I have tried different properties, methods and events, but I cannot seem to get the file to attach to the email. (I have tried using @FilePath, @Attachments. There is no @Add in the Def file, so I can use that)

Any help would be appreciated.
Hi,

Sorry about that - can't read obviously.

Was just about to post then saw Kieth's message.

We too use this winbmail program - changed a little bit, but not much.
I'd suggest grabbing the original though.
http://www.acucorp.com/support/supported/customer_forum/showthread.php?t=297
Here's what we're using.
Hopefully this helps.

Shaun

  • September 27, 2019
Hi,

Sorry about that - can't read obviously.

Was just about to post then saw Kieth's message.

We too use this winbmail program - changed a little bit, but not much.
I'd suggest grabbing the original though.
http://www.acucorp.com/support/supported/customer_forum/showthread.php?t=297
Here's what we're using.
Hopefully this helps.

Shaun

Hi

Are you capable to used Microsoft Exchange if yes waht are entering to server port user ...

Thank you