Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

GetMail with support for SSL/TLS

The native OI GetMail function does not appear to support SSL/TLS that Gmail now requires to pull messages from their POP server. I now need to download messages from a gmail account (specifically to log undeliverable email addresses and not risk being labeled a spammer for repeated undeliverable messages). Any suggestions? I was headed towards an external tool that writes the messages to the local drive, but thought I would pose the question to the SRP gurus.


  • use the srP_MAIL function - i use it. Drop a note and i'll post the code, though it's in the forum
  • I have the SRP Mail Utility, but I thought it was for sending email only. I cannot find anything in the forum search for "SRP_Mail"
  • COMPILE function nv_email_support(directive, params)
    // This program is proprietary and is not to be used by or disclosed to others,
    // nor is it to be copied without written permission from Envizion Systems Pty Ltd.
    // Name :
    // Description: send email to support/helpdesk@powerforcesoftware.com
    // directly onto internet not via user setups

    // * Date: 2012-08-09 17:34:21 +1000 (Thu, 09 Aug 2012)
    #PRAGMA OUTPUT SYSLISTS mpd_nv_email_support

    $insert nv_copyright
    $insert nv_userprefs
    $insert msg_equates
    $insert usercommon_ins
    $insert srpmail_inserts

    EQU NO$ TO 0
    EQU YES$ TO 1
    EQU SENDTO$$ TO "helpdesk@powerforcesoftware.com"

    declare function GetNetworkUserName
    declare subroutine check_assignments, Set_Status

    check_assignments( directive, params )

    buffer = space(255)
    ThisUserName= GetNetworkUserName(buffer, len(buffer)) ; // get name

    GOSUB package_srp:

    RETURN msgSent


    // Compile function Send_Email_Sample(SendTo, CC, Subject, Body, From, ReplyTo, SRPMailAttach, ConfigFile, Bcc)

    * This program is proprietary and is not to be used by or disclosed to others, nor is it to
    * be copied WITHout written permission from SRP Computer Solutions.
    * Name : Send_Email_Sample
    * Description: Sends an email via the SRPMail.dll
    * Notes : Please refer to the SRPMail.chm
    * Parameters :
    * MsgSent [out] -- RETURNs a boolean value as to whether or not the message was sent
    * successfully
    * SendTo [in] -- An @VM delimited list of email addresses; required parameter
    * CC [in] -- An @VM delimited list of email addresses
    * Subject [in] -- Text that will appear IN the subject line of the email
    * Body [in] -- The actual text of the email; use CRLF$ to break or INsert lines;
    * required parameter
    * From [in] -- The account to send the email from
    * ReplyTo [in] -- The account that all replies should go to.
    * SRPMailAttach [in] -- The file to be used as an attachment for the SRPMail program.
    * ConfigFile [in] -- The record which contains the SRPMail Config variables.
    * Bcc [in] -- An @VM delimited list of email address
    * History (Date, INitials, Notes)
    * 01/05/04 ps Sample version created.

    Process = 0
    Error = 0

    Process += 1
    Until Error OR Process GT 2
    On Process GOSUB SET, SEND

    // TODO archive whole msg

    RETURN MsgSent ; // this needs to be stored by us

    sendto = SENDTO$$
    CONVERT "," to @VM IN sendto
    aTitle = "Attachment Title"
    aPath = "d:\temp"
    eDialog = "eDialog"
    MsgSent = No$

    IF Assigned(SendTo) else SendTo = ""
    IF Assigned(CC) else CC = ""
    IF Assigned(sender) else sender = SENDTO$$
    IF Assigned(Subject) else Subject = ""
    IF Assigned(Body) else Body = ""
    IF Assigned(aTitle) else aTitle = ""
    IF Assigned(aPath) else aPath = ""
    IF Assigned(eDialog) else eDialog = Yes$
    IF Assigned(sender) else sender = ""
    IF Assigned(ReplyTo) else ReplyTo = ""
    IF Assigned(SRPMailAttach) else SRPMailAttach = ""
    IF Assigned(ConfigFile) else ConfigFile = ""
    IF Assigned(Bcc) else Bcc = ""
    IF Assigned(HistoryTable) else HistoryTable = ""
    IF SendTo EQ "" THEN Error = Yes$
    MsgSent = ""

    * TODO extract this from system configuration.
    * Place this into /COMMON/ so as not to waste cycles
    gmail = 1 ; // we always fly gmail
    ConfigFile = "" ; * Parameters required for the SRPMail dll. Leave the first 4 alone.
    ConfigFile<1> = 2 ; * Send Using Port (Email server not on local machine)
    ConfigFile<2> = ""
    ConfigFile<3> = 25 ; * SMTP Server Port
    IF gmail THEN
    ConfigFile<3> = 465

    IF gmail THEN
    ConfigFile<4> = "smtp.gmail.com"

    ConfigFile<5> = 1 ; * SMTP AuTHENtication

    * ConfigFile<6> = "shared.services@xxxxxx.com.au" ; // NPS

    ConfigFile<6> = ""
    IF gmail THEN
    ConfigFile<6> = "helpdesk@xxxxxxxx.com" ; * Account User Name

    ConfigFile<7> = ""
    IF gmail THEN
    ConfigFile<7> = "email-password" ; * Account Password

    ConfigFile<8> = 0
    IF gmail THEN
    ConfigFile<8> = 1

    SWAP @VM WITH @FM IN ConfigFile
    IF ConfigFile THEN
    GOSUB Send_SRP_Mail
    Error = Yes$

    SWAP @VM WITH ", " IN SendTo
    SWAP @VM WITH ", " IN CC
    SWAP @VM WITH ", " IN Bcc
    // SWAP @VM WITH ", " IN SRPMailAttach
    SWAP @FM WITH ", " IN SendTo
    SWAP @FM WITH ", " IN CC
    SWAP @FM WITH ", " IN Bcc
    SWAP @FM WITH @VM IN SRPMailAttach ; // 28/12/13 TODO check this

    Message = ""
    Message<1> = Subject
    Message<2> = sender
    Message<3> = sendto
    Message<4> = CC
    Message<5> = Bcc
    Message<6> = ReplyTo

    HTMLCheck = Body[1, 6]

    IF HTMLCheck _eqc "" THEN
    Message<7> = "HTML"
    Message<7> = "TEXT"

    Message<8> = Body
    Message<9> = SRPMailAttach
    Message<10>= 1 ; // Normal Importance

    MsgSent = SRP_Send_Mail(Message, ConfigFile)
    IF msgSent NE 1 THEN
    // 28/12/13 TODO keep log of failed emails to self
    // email whence ready
  • Jim,

    As you suspected, the SRP Mail Utility does not have a "GetMail" feature. Most of the times we've needed to make OI into an email listener we've been working with Exchange accounts so our solution was to use Office OLE Automation.

    A long time ago I did find a GetMail command line utility and integrated that with the SRP Run Command. I don't know what utility that was anymore and I couldn't even tell you if it now supports SSL/TLS. Doing a quick Google search returns lots of similar tools so I suspect you'll be able to find something that will work for you.
  • Jim, SRP Mail is currently for sending mail only. I was waiting to see if others had a solution, but I suppose not. I know of some C++ libraries out there that support POP3 and SSL, but integrating it into SRP Mail is not something that would happen soon enough to solve your immediate problem.
  • Jim, I realize this isn't the solution you were looking for but a slightly off-the-wall idea and possible improvement in mail handling would be to have the messages sent to MailGun and then use their REST API to manage and get the messages. You can do some very useful tasks by sending and receiving messages through MailGun such as detecting bounced messages and having an easier time parsing message components. Here is an example of using MailGun to receive messages.
Sign In or Register to comment.