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

  • 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.
  • 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).