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.
Comments
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
// 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
* CONVERT @LOWER.CASE TO @UPPER.CASE IN ThisUserName
GOSUB package_srp:
RETURN msgSent
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
package_srp:
// 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
Loop
Process += 1
Until Error OR Process GT 2
On Process GOSUB SET, SEND
Repeat
// TODO archive whole msg
RETURN MsgSent ; // this needs to be stored by us
set:
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 = ""
RETURN
/*
* TODO extract this from system configuration.
* Place this into /COMMON/ so as not to waste cycles
*/
send:
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
END
IF gmail THEN
ConfigFile<4> = "smtp.gmail.com"
END
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
END
ConfigFile<7> = ""
IF gmail THEN
ConfigFile<7> = "email-password" ; * Account Password
END
ConfigFile<8> = 0
IF gmail THEN
ConfigFile<8> = 1
END
SWAP @VM WITH @FM IN ConfigFile
IF ConfigFile THEN
GOSUB Send_SRP_Mail
END ELSE
Error = Yes$
END
RETURN
send_srp_mail:
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]
CONVERT @LOWER_CASE to @UPPER_CASE IN HTMLCheck
IF HTMLCheck _eqc "" THEN
Message<7> = "HTML"
END ELSE
Message<7> = "TEXT"
END
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
////////////////////////////////////////////////////////////////////////////////
END
RETURN
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.