Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Former Member Absent Member.
Absent Member.
1248 views

[archive] Attaching docs to email using SMTP

[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.
0 Likes
6 Replies
Former Member Absent Member.
Absent Member.

RE: [archive] Attaching docs to email using SMTP

@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.
0 Likes
Former Member Absent Member.
Absent Member.

RE: [archive] Attaching docs to email using SMTP

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.
0 Likes
Former Member Absent Member.
Absent Member.

RE: [archive] Attaching docs to email using SMTP

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.
0 Likes
Former Member Absent Member.
Absent Member.

RE: [archive] Attaching docs to email using SMTP

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
0 Likes
Former Member Absent Member.
Absent Member.

RE: [archive] Attaching docs to email using SMTP

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
0 Likes
MichelM Trusted Contributor.
Trusted Contributor.

Re: RE: [archive] Attaching docs to email using SMTP

Hi

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

Thank you

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.