Sending Email using Gmail and other newer protocols

We want to send emails from an Acucobol version 6.2 program using various email protocols

We have successfully been able to send emails using the ActiveX control autogen for Outlook.  We have also used the sample program WINBMAIL which uses C$SOCKET to send emails from Yahoo and  MIcrosoft email applications (Live, Outlook, Hotmail, MSN).  However we have not been able to successfully send emails using this version of WINBMAIL with Gmail even after installing STUNNEL.

Our clients use many different email protocols for sending emails and Outlook is not a built-in feature in Windows7.  We do not want to force our customers to install it or have Outlook as their default email client.

Is there a newer version of WINBMAIL that supports the newer email protocols?  Is there a sample program using an ActiveX autogen for Thunderbird?

Old posts on this forum indicate that there is a product from Marshallsoft that can be purchased to send emails.  We don't want to go this route unless there is no other alternative.

Thanks.

  • Verified Answer

    I think that a better way, or at least a different way, is to use VBScript, and invoke it via a CALL "SYSTEM".

    A key benefit is:  FREE.

    A Google search reveals several such scripts, which are quite similar:

    http://cybernetnews.com/vbscript-send-emails-using-gmail/
    http://notes.ponderworthy.com/send-email-via-gmail-smtp-by-vbscript

    I have recently done one of these scripts for use with my RM/COBOL application.  I used XML Extensions (also available on newer AcuCOBOL releases) to create a parameter file so that the command line was simpler.  (We wanted to do multiple optional attachments, large TO and BCC lists, etc.)  Getting parameters from the XML document in the VBScript is simpler than trying to process a large variety of command line parameters.  Should you need this level of complexity and want to use the command line, I will suggest using named parameters. 

    Tom Morrison
    Hill Country Software

  • Thank you so much Tom for your reply.  I implemented your suggestion about calling a VBScript and I was able to successfully send emails from GMail and other email protocols.  I've never used VBScript before so there was a learning curve.

    I haven't yet figured out how to hide the DOS screen though.  Adding "No I-O" as part of the CALL "SYSTEM" command did not work.  Any suggestions?

    Thanks again.

    Marlene

  • Thank you so much Tom for your reply.  I implemented your suggestion about calling a VBScript and I was able to successfully send emails from GMail and other email protocols.  I've never used VBScript before so there was a learning curve.

    I haven't yet figured out how to hide the DOS screen though.  Adding "No I-O" as part of the CALL "SYSTEM" command did not work.  Any suggestions?

    Thanks again.

    Marlene

  • Thank you so much Tom for your reply.  I implemented your suggestion about calling a VBScript and I was able to successfully send emails from GMail and other email protocols.  I've never used VBScript before so there was a learning curve.

    I haven't yet figured out how to hide the DOS screen though.  Adding "No I-O" as part of the CALL "SYSTEM" command did not work.  Any suggestions?

    Thanks again.

    Marlene

  • Yes, learning VBScript takes some time.  Fortunately, the web is full of examples for just about every possible thing you can imagine, so I 'learn' using search.

    I am far from an expert on AcuCOBOL, having been associated with RM/COBOL my entire career, but it appears that C$SYSTEM (rather than SYSTEM) gives you access to the flags that can be used on Windows to cause a command to be run in a hidden window.  In particular, the flag CSYS-HIDDEN (value 32) seems correct.

    My application is hosted by Business Information Server - that is, it is a browser based web application.  So the user never sees the window flash because the window is on the web server.  Just for the record, for any RM/COBOL user reading this, the SYSTEM window type is configurable by using the rmconfig registry configuration tool, or by CALLing C$GUICFG.

  • Thanks again, Tom.  Using C$SYSTEM for the call with the CSYS-HIDDEN flag set worked!

  • Tom, this suggestion works perfectly for me with smaller emails.  However the product I'm working with requires large-body emails to be sent out.  Since there is a limit to 1024 bytes in a command line, is there a way to use the vbscript differently to handle this?

    Thanks,

    Edgar

  • I had this exact problem.  I put the email body in a file and read the file in the VBScript.

    Here is some of the code:

    Const ForReading = 1

    Dim emailObj, emailConfig

    Dim fso, f , BodyText

    Set fso = CreateObject("Scripting.FileSystemObject")

    Set emailObj      = CreateObject("CDO.Message")

    emailObj.To       = WScript.Arguments.Item(2)

    emailObj.Subject  = WScript.Arguments.Item(3)

    BodyText = fso.OpenTextFile(WScript.Arguments.Item(4),ForReading).ReadAll

    emailObj.TextBody = BodyText

    emailObj.From     = WScript.Arguments.Item(0)

    Hope this helps.

    Regards,

    Marlene

  • I had this exact problem.  I put the email body in a file and read the file in the VBScript.

    Here is some of the code:

    Const ForReading = 1

    Dim emailObj, emailConfig

    Dim fso, f , BodyText

    Set fso = CreateObject("Scripting.FileSystemObject")

    Set emailObj      = CreateObject("CDO.Message")

    emailObj.To       = WScript.Arguments.Item(2)

    emailObj.Subject  = WScript.Arguments.Item(3)

    BodyText = fso.OpenTextFile(WScript.Arguments.Item(4),ForReading).ReadAll

    emailObj.TextBody = BodyText

    emailObj.From     = WScript.Arguments.Item(0)

    Hope this helps.

    Regards,

    Marlene

  • I had this exact problem.  I put the email body in a file and read the file in the VBScript.

    Here is some of the code:

    Const ForReading = 1

    Dim emailObj, emailConfig

    Dim fso, f , BodyText

    Set fso = CreateObject("Scripting.FileSystemObject")

    Set emailObj      = CreateObject("CDO.Message")

    emailObj.To       = WScript.Arguments.Item(2)

    emailObj.Subject  = WScript.Arguments.Item(3)

    BodyText = fso.OpenTextFile(WScript.Arguments.Item(4),ForReading).ReadAll

    emailObj.TextBody = BodyText

    emailObj.From     = WScript.Arguments.Item(0)

    Hope this helps.

    Regards,

    Marlene