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.
bjdouglas Absent Member.
Absent Member.
454 views

Retrieve emails from a specific email address using COBOL

 We have a COBOL program that we use to send emails from our system written in COBOL. It uses SMTP to link to email servers via a Socket using C$SOCKET and works well. We even send binary attachments using base-64 conversion. Now this works fine and was based on the example program sendmail.

We now have a new requirement to access a specific email address, and we want to retrieve all emails sent to it, and update our system creating a service call. Has anyone else done this? Is there an example COBOL source code that does this? I have looked for one but have not found anything. 

Any help would be most appreciated.

Regards

Brian

0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

RE: Retrieve emails from a specific email address using COBOL

Since you say you have to "retrieve ... emails" from "a specific email address", I'll assume you're not looking to implement an actual MTA (Mail Transfer Agent, i.e. an SMTP server), and that this email address is already handled by an existing server, which currently will store the incoming messages.

You'll have to find out what protocols that server implements for clients to use in retrieving messages. The most common are the open IMAP and POP3 protocols, and Microsoft's proprietary Exchange protocol.

If your server supports IMAP or POP3, the easiest thing, frankly, is to have your program execute a scriptable email client (technically an MUA, or Mail User Agent). If you're determined to download messages within your application, any number of IMAP and POP3 libraries can be found online. If you *really* want to implement it yourself, they're documented; POP3, for example, is RFC1939.

If the server is Exchange, and your application is running on Windows, you'd use Microsoft's Messaging API (MAPI), a standard part of the Windows SDK. It's well-documented by Microsoft.
0 Likes
ShanePrice Absent Member.
Absent Member.

RE: Retrieve emails from a specific email address using COBOL

We've been using controls from Chilkat for several years (early Windows XP days) for not only email but also Zip compression, FTP, FTPS, SFTP, etc. They have controls that will work with Windows (ActiveX and .NET) as well as Linux, Solaris, etc. (www.chilkatsoft.com/products.asp)

The controls come with a 30-day trial, free updates during active support contract, and royalty-free distribution (www.chilkatsoft.com/licensingExplained.asp).
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.