Discussion:
BLAT and GMAIL accounts
(too old to reply)
MB Software Solutions, LLC
2010-05-25 23:01:03 UTC
Permalink
Has anyone successfully configured BLAT to work for a gMail account?
--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16
Sytze de Boer
2010-05-25 23:37:14 UTC
Permalink
I tried but gave up and use Gmail with
loConfig = Createobject("CDO.Configuration")

Very simple, it works
S



On Wed, May 26, 2010 at 11:01 AM, MB Software Solutions, LLC <
Post by MB Software Solutions, LLC
Has anyone successfully configured BLAT to work for a gMail account?
--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16
[excessive quoting removed by server]
MB Software Solutions, LLC
2010-05-26 01:05:41 UTC
Permalink
Post by Sytze de Boer
I tried but gave up and use Gmail with
loConfig = Createobject("CDO.Configuration")
Very simple, it works
S
Can you share the rest of the code?
--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16
Sytze de Boer
2010-05-26 01:12:24 UTC
Permalink
Mike, my pleasure
S


parameter wasitanupdate
gogmess=''
IF wasitanupdate
WAIT WINDOW NOWAIT 'Now updating your system '+CHR(13)+;
'This may take from 1 to 2 minutes and does not require you to press any
keys. Coffee time ?........'
ELSE
WAIT WINDOW NOWAIT 'Now preparing sending the message........'
ENDIF

DO trmoment WITH 'moment'
trcask69=''
TRY
**http://fox.wikis.com/wc.dll?Wiki~CdoEmail~VFP
Local lcSchema, loConfig, loMsg, loError, lcErr
lcErr = ""
lcSchema = "http://schemas.microsoft.com/cdo/configuration/"
loConfig = Createobject("CDO.Configuration")
With loConfig.Fields
.Item(lcSchema + "smtpserver") = "smtp.gmail.com"
.Item(lcSchema + "smtpserverport") = 465 && ó 587
.Item(lcSchema + "sendusing") = 2
.Item(lcSchema + "smtpauthenticate") = .T.
.Item(lcSchema + "smtpusessl") = .T.
.Item(lcSchema + "sendusername") = "myusername"
.Item(lcSchema + "sendpassword") = "mypassword"
.Update
Endwith
loMsg = Createobject ("CDO.Message")
mattachmnt=""
IF FILE("INFO.JPG")
IF !wasitanupdate
mattachmnt= "YES" &&SYS(5)+CURDIR()+"INFO.JPG"
&& full path=imperative
endif
endif

With loMsg
.Configuration = loConfig
.From = "***@gmail.com"
.To = "***@gmail.com"
If wasitanupdate
.Subject = "WinkissUpdate"
Else
.Subject = "WK-ErrorReport"
IF mattachmnt="YES"
.AddAttachment(SYS(5)+CURDIR()+"INFO.JPG")
endif
ENDIF

mq=''
IF USED("WINDEBS")
mq="D:"+ALLTRIM(STR(RECCOUNT("WINDEBS")))
endif
IF USED("PEMP")
mq=mq+",P:"+ALLTRIM(STR(RECCOUNT("PEMP")))
endif
IF USED("GLTRANS")
mq=mq+",G:"+ALLTRIM(STR(RECCOUNT("GLTRANS")))
endif
gogmess=mq
gogmess=gogmess+" G,System: "+ALLTRIM(winkiss.popup7)+CHR(13)

gogmess=gogmess+" Debtors : "+ALLTRIM(winmast.name) +CHR(13)
gogmess=gogmess+" Payroll : "+ALLTRIM(pmaster.name) +CHR(13)
gogmess=gogmess+" Gl : "+ALLTRIM(glmaster.name) +CHR(13)

If wasitanupdate
gogmess=gogmess+" Updated from "+ALLTRIM(STR(trcask56,10,2))+" to:
"+trdate2()
else
gogmess=gogmess+errmess
ENDIF

.TextBody = gogmess
.Send()
Endwith

Catch To loError
trcask69=[Error: ] + Str(loError.ErrorNo) + Chr(13) + [Line: ] +
Str(loError.Lineno) + Chr(13) + [Message: ] + loError.Message
lcErr =[Error: ] + Str(loError.ErrorNo) + Chr(13) + [Line: ] +
Str(loError.Lineno) + Chr(13) + [Message: ] + loError.Message

Finally
Release loConfig, loMsg
Store .Null. To loConfig, loMsg
If !wasitanupdate
If Empty(lcErr)
Messagebox("Message sent", 64, "Have a great day")
Else
Messagebox(lcErr, 16 , "Error")
ENDIF
endif
ENDTRY
DO trmoment

IF AT("0x80040127",trcask69)>0
=MESSAGEBOX("Windows Information message 80040127"+CHR(13)+;
"This message is NOT an urgent message, but if you see it, please drop us
a note/email to say you spotted it"+CHR(13)+;
"A simple little message that says 'gotcha' will do. Many thanks
",0,'')
ENDIF

IF !EMPTY(trcask69)
DO trblat899 WITH wasitanupdate, gogmess
ENDIF

On Wed, May 26, 2010 at 1:05 PM, MB Software Solutions, LLC <
Post by MB Software Solutions, LLC
Post by Sytze de Boer
I tried but gave up and use Gmail with
loConfig = Createobject("CDO.Configuration")
Very simple, it works
S
Can you share the rest of the code?
--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16
[excessive quoting removed by server]
Ted Roche
2010-05-26 13:05:47 UTC
Permalink
Post by Sytze de Boer
On Wed, May 26, 2010 at 11:01 AM, MB Software Solutions, LLC <
Post by MB Software Solutions, LLC
Has anyone successfully configured BLAT to work for a gMail account?
I don't think that's going to happen. Gmail requires TLS/SSL
(http://lifehacker.com/111166/how-to-use-gmail-as-your-smtp-server)
and BLAT isn't configured to support that. Other big providers like
Yahoo! have the same kind of requirements.

I'm sure there's some long and involved convoluted reason why you
can't configure your app just to use the local ISP SMTP server. We've
set up a couple apps using BLAT (or West Wind's IPTools) and we just
supply an .INI file with settings that the client (or we) configure.
Obviously, the idea has some problems scaling, supporting a couple
hundred installations would be taxing.

I've used GMail by configuring a local sendmail instance to use them
as a smart host, but it involves a Linux box and setting up OpenSSL
and downloading and configuring certificates. If you've got an app
that you're sending out for wide distribution and you don't want to
set up each and every client individually, you could considering
renting a box/virtual server at your hosting provider of choice, and
sending all of the mail from the clients to the mail server you host
and configure. It's a non-trivial solution, but it leave you in
control and could be set up for a few hundred dollars a year.

Remember, "MAPI Bad, SMTP good" isn't just snarky, it's a statement of
Best Practices. Using automation to Outlook, ActiveX Email,
Collaborative Data Objects, or whatever, is just leaving your app at
the mercy of the next MSFT service pack that decides to change the way
it works or block a service as a security measure. Offloading
fundamental network services to the standardized protocols and servers
designed to run those services is using the Internet in the way it was
intended.
--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com
Grigore Dolghin
2010-05-26 14:09:08 UTC
Permalink
Hi. This is the class I am using to send emails. Maybe someone finds it useful:

**************************************************
*-- Class: b_emailmgr (c:\dev\vfp\common\libs\b_emailmgr.vcx)
*-- ParentClass: b_cst (c:\dev\vfp\common\libs\b_basevcx.vcx)
*-- BaseClass: custom
*-- Time Stamp: 12/17/09 05:32:07 PM
*
DEFINE CLASS b_emailmgr AS Custom


serveraddress = ""
serverport = 25
usessl = .F.
*-- 0 = None; 1 - Basic (clear-text), 2 - NTLM
authentication = 0
serverusername = ""
serverpassword = ""
connectiontimeout = 60
from = ""
to = .F.
cc = .F.
bcc = .F.
subject = .F.
textbody = .F.
htmlbody = .F.
attachments = .F.

*-- Occurs when the Valid event returns false (.F.), and provides a
means to display an error message.
errormsg = .F.


PROCEDURE send
**********************************************************************
* Program....: B-Emailmgr.Send
* Version....:
* Author.....: Grigore Dolghin
* Date.......: 31 October 2008, 12:32:58
* Notice.....: Copyright © 2008, Class Software.
* Compiler...: Visual FoxPro 09.00.0000.5815 for Windows
* Abstract...:
* Changes....: Grigore Dolghin, Created 31 October 2008 / 12:32:58
* Parameters.:
* Called by..:
* Purpose....: sends the message.
**********************************************************************
Local ;
llSuccess As Boolean, ;
loMail As "CDO.Message", ;
loConfig As CDO.Configuration, ;
lnI As Integer

With This
If ._CheckPrerequisites()
loMail = CreateObject("CDO.Message")
loConfig = loMail.Configuration

With loConfig As CDO.Configuration
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= This.ServerAddress
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= This.ServerPort
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")
= This.UseSSL
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= This.ConnectionTimeout
If This.Authentication > 0
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= This.Authentication
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")
= This.Username
.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")
= This.ServerPassword
EndIf
.Fields.Update
EndWith

With loMail As CDO.Message
.Sender = This.From
.To = This.To
.CC = This.CC
.BCC = This.BCC
.Subject = This.Subject
.TextBody = This.TextBody
If Not Empty(This.HTMLBody)
.HTMLBody = This.HTMLBody
EndIf

For Each loFile In .Attachments
loMail.AddAttachment(loFile)
EndFor

Try
loMail.Send()
llSuccess = .T.
Catch To loError
This.ErrorMsg = loError.Message
Finally
Release loMail
EndTry
EndWith
EndIf
EndWith
Return llSuccess
ENDPROC


PROCEDURE addattachment
**********************************************************************
* Program....: B-EmailMgr.AddAttachment
* Version....:
* Author.....: Grigore Dolghin
* Date.......: 31 October 2008, 12:29:38
* Notice.....: Copyright © 2008, Class Software.
* Compiler...: Visual FoxPro 09.00.0000.5815 for Windows
* Abstract...:
* Changes....: Grigore Dolghin, Created 31 October 2008 / 12:29:38
* Parameters.:
* Called by..:
* Purpose....: Adds a file to the attachments collection.
**********************************************************************
Lparameters tcFileName

Local lnCounter As Integer

With This
lnCounter = .Attachments.Count + 1
.Attachments.Add(tcFileName, Transform(lnCounter))
EndWith
ENDPROC


PROCEDURE removeattachment
**********************************************************************
* Program....: B-EmailMgr.RemoveAttachment
* Version....:
* Author.....: Grigore Dolghin
* Date.......: 31 October 2008, 12:32:36
* Notice.....: Copyright © 2008, Class Software.
* Compiler...: Visual FoxPro 09.00.0000.5815 for Windows
* Abstract...:
* Changes....: Grigore Dolghin, Created 31 October 2008 / 12:32:36
* Parameters.:
* Called by..:
* Purpose....: Removes a file from attachments collection.
**********************************************************************
Lparameters tnAttachmentIndex As Integer

With This
If tnAttachmentIndex <= .Attachments.Count
.Attachments.Remove(tnAttachmentIndex)
EndIf
EndWith
ENDPROC


PROTECTED PROCEDURE _checkprerequisites
**********************************************************************
* Program....: B-EmailMgr._CheckPrerequisites
* Version....:
* Author.....: Grigore Dolghin
* Date.......: 31 October 2008, 12:30:11
* Notice.....: Copyright © 2008, Class Software.
* Compiler...: Visual FoxPro 09.00.0000.5815 for Windows
* Abstract...:
* Changes....: Grigore Dolghin, Created 31 October 2008 / 12:30:11
* Parameters.:
* Called by..:
* Purpose....: Checks if all the prerequisites for email are satisfied.
**********************************************************************
Local ;
llSuccess As Boolean, ;
lcFile As String

llSuccess = .T.
With This
If llSuccess And Empty(.ServerAddress)
.ErrorMsg = "No SMTP server specified."
llSuccess = .F.
EndIf
If llSuccess And .Authentication > 0
If llSuccess And Empty(.Username)
.ErrorMsg = "No username specified."
llSuccess = .F.
EndIf
If llSuccess And Empty(.ServerPassword)
.ErrorMsg = "No password specified."
llSuccess = .F.
EndIf
EndIf
If llSuccess And Empty(.From)
.ErrorMsg = "'From' field is empty."
llSuccess = .F.
EndIf
If llSuccess And Empty(.To)
.ErrorMsg = "'To' field is empty."
llSuccess = .F.
EndIf
If llSuccess
For Each oFile In .Attachments
If Not File(oFile)
.ErrorMsg = "File " + oFile + " cannot be found."
llSuccess = .F.
Exit
EndIf
EndFor
EndIf

If llSuccess
.ErrorMsg = ""
EndIf
EndWith

Return llSuccess
ENDPROC

PROCEDURE Init
.Attachments = CreateObject("Collection")
ENDPROC

ENDDEFINE
*
*-- EndDefine: b_emailmgr
**************************************************
Post by Ted Roche
Post by Sytze de Boer
On Wed, May 26, 2010 at 11:01 AM, MB Software Solutions, LLC <
Post by MB Software Solutions, LLC
Has anyone successfully configured BLAT to work for a gMail account?
I don't think that's going to happen. Gmail requires TLS/SSL
(http://lifehacker.com/111166/how-to-use-gmail-as-your-smtp-server)
and BLAT isn't configured to support that. Other big providers like
Yahoo! have the same kind of requirements.
I'm sure there's some long and involved convoluted reason why you
can't configure your app just to use the local ISP SMTP server. We've
set up a couple apps using BLAT (or West Wind's IPTools) and we just
supply an .INI file with settings that the client (or we) configure.
Obviously, the idea has some problems scaling, supporting a couple
hundred installations would be taxing.
I've used GMail by configuring a local sendmail instance to use them
as a smart host, but it involves a Linux box and setting up OpenSSL
and downloading and configuring certificates. If you've got an app
that you're sending out for wide distribution and you don't want to
set up each and every client individually, you could considering
renting a box/virtual server at your hosting provider of choice, and
sending all of the mail from the clients to the mail server you host
and configure. It's a non-trivial solution, but it leave you in
control and could be set up for a few hundred dollars a year.
Remember, "MAPI Bad, SMTP good" isn't just snarky, it's a statement of
Best Practices. Using automation to Outlook, ActiveX Email,
Collaborative Data Objects, or whatever, is just leaving your app at
the mercy of the next MSFT service pack that decides to change the way
it works or block a service as a security measure. Offloading
fundamental network services to the standardized protocols and servers
designed to run those services is using the Internet in the way it was
intended.
--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com
[excessive quoting removed by server]
Jarvis, Matthew
2010-05-26 15:49:33 UTC
Permalink
-----Original Message-----
On Behalf Of Ted Roche
Sent: Wednesday, May 26, 2010 6:06 AM
Subject: Re: BLAT and GMAIL accounts
Offloading
fundamental network services to the standardized protocols and servers
designed to run those services is using the Internet in the way it was
intended.
--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com
Good stuff Ted.... SOOOOOO true....

I'd like to frame that and put it on my wall....

Thanks,

Matthew Jarvis || Business Systems Analyst
IT Department
McKenzie-Willamette Medical Center
1460 G Street, Springfield, OR 97477 || Ph: 541-744-6092 || Fax:
541-744-6145
--------------------------------------------------------------------------
Disclaimer: This electronic message may contain information that is
Proprietary, Confidential, or legally privileged or protected. It
is intended only for the use of the individual(s) and entity named
in the message. If you are not an intended recipient of this
message, please notify the sender immediately and delete the
material from your computer. Do not deliver, distribute or copy
this message and do not disclose its contents or take any action in
reliance on the information it contains.
Ted Roche
2010-05-26 17:36:13 UTC
Permalink
Post by Jarvis, Matthew
On Behalf Of Ted Roche
Offloading
fundamental network services to the standardized protocols and servers
designed to run those services is using the Internet in the way it was
intended.
Good stuff Ted.... SOOOOOO true....
I'd like to frame that and put it on my wall....
Well, thanks. Sometimes I worry I'm either preaching to the choir or
yelling in the darkness.

It was a lesson hard-earned.
--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com
MB Software Solutions, LLC
2010-05-27 16:31:22 UTC
Permalink
Post by Ted Roche
Post by Jarvis, Matthew
On Behalf Of Ted Roche
Offloading
fundamental network services to the standardized protocols and servers
designed to run those services is using the Internet in the way it was
intended.
Good stuff Ted.... SOOOOOO true....
I'd like to frame that and put it on my wall....
Well, thanks. Sometimes I worry I'm either preaching to the choir or
yelling in the darkness.
It was a lesson hard-earned.
Excellent tips (as usual), Ted.
--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16
Continue reading on narkive:
Loading...