[AccessD] Using BLAT as an Emailer

Jim Dettman jimdettman at verizon.net
Fri Mar 5 13:36:01 CST 2010


David,

  Only issue I had with Blat is that the .DLL has fewer features then the
command line shell and using the DLL was the only way I could find of
returning an error if an e-mail was not sent.

  It seemed like the DLL had not been worked on in quite some time last time
I looked.

  I always use it though for basic e-mail testing and anything that I need
to do with scripting/batch jobs.

Jim.

   

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee
Sent: Thursday, March 04, 2010 8:42 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Using BLAT as an Emailer

Fransisco and I used BLAT in one of our old ADPs when we worked together.

It was awesome. We even built it into the error handler to email us
the error number, the form name, the sub name and if needed certain
parameter values.

We started using Blat after MS released that draconian patch for Outlook
2000.

I think they are still using it at that company.

David

On Thu, Mar 4, 2010 at 5:06 PM, Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:
> Blat supports several form of AUTH and also POP3 login before send.
> You just need to pass the Username/PW as parameters.
>
>
>
> --
> Stuart
>
> On 4 Mar 2010 at 16:37, Rocky Smolin wrote:
>
>> What about the authentication problem?
>>
>> r
>>
>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
>> Sent: Thursday, March 04, 2010 3:59 PM
>> To: 'Access Developers discussion and problem solving'
>> Subject: [AccessD] Using BLAT as an Emailer
>>
>>
>> Hi Guys,
>>
>> Here is an example of using BLAT as an Emailer.
>> Replaces CDO, Redemption, docmd.SendObject, Outlook, ClickYes, etc, etc
>>
>> FREE. I have used it in 32bit and this example was just used in 64bit so
the
>> program (blat) is pretty stable.
>> Example is tested in A2k3
>> Example is tested using a know smtp server with login details. I have not
>> tried it in gmail. (yest)
>>
>> Replace smtp login details with your own.
>>
>> Max
>>
>>
>> Option Compare Database
>> Option Explicit
>> ' Example by Max.Wanadoo at gmail.com
>> ' Thanks to Stuart for helping to get the  batch call running correctly.
>>
>> ' NOW:Forget  CDO.
>> ' Forget Redemption
>> ' Forget SendObject
>> ' We have BLAT.
>> ' Free and NO installation - just put a copy in your project folder and
>> build some text files.
>>
>>
>> ' Download Blat.zip from http://www.blat.net/ ' extract the contents and
>> place them in your app folder (we only need the blat.exe but the rest
will
>> be worth reading.
>> ' you can then create a FORM where the user can enter variables.  We will
>> assume some constants,  but these can ' be variables as well.
>> ' You can also store them in tables if  you wish (I would) ' This is just
an
>> exampls so that you understand how it works.
>> ' full details of all the options are in the downloaded text files from
>> blat.net
>>
>> ' HERE are the contents of the text files used as examples. You can
create
>> these on the fly from within Access.
>>
>> ' Subject.txt = "Hello World"
>> ' Body.txt = This is a test email from Blat.
>> ' Recipients.txt = max.wanadoo at gmail.com, max.wanadoo at gmail.com,
>> max.wanadoo at gmail.com ' cc.txt = max.wandoo at gmail.com ' bcc.txt =
>> max.wanadoo at gmail.com ' Signature.txt = Max, Manager ' ps.txt = PS. To
>> unsubscribe send an email to helpmeplease at heaven.com
>>
>>
>> Private sBlatFile, sBlatLog
>>
>> Sub BlatExample()
>> 'place these varibles in a form  for the user  to enter. We will just
create
>> them 'from here  to show how they fit together to make Blat work.
>> ' What I have done is to put the contents of the various bits into
external
>> text files and call them with these ' variables but you can put them
>> directly into the varible if you change the calling Blat Switch where
>> required.
>> ' See Blat file for documentation or drop me a line.  EG, -tf (to file)
>> becomes -to (address list to send to) ' The files I have used are
arbitarily
>> named and I would antipate generting them from within Access where
>> appropriate.
>>
>>     If BlatCreate( _
>>        sFrom:="me at mydomain.org", _
>>        sRecipients:="Recipients.txt", _
>>        sCC:="CC.txt", _
>>        sBCC:="bcc.txt", _
>>        sSubject:="subject.txt", _
>>        sBody:="Body.txt", _
>>        sSMTPServer:="smtp.mydomain.org", _
>>        sSMTPUser:="me at mydomain.org", _
>>        sSMTPPwd:="mysecretsmtppassword", _
>>        sSignature:="Signature.txt", _
>>        sPS:="ps.txt", _
>>        sAttach:="Attach.txt") = 0 Then
>>         Call sShell(sBlatFile)
>>     End If
>> End Sub
>>
>> Function BlatCreate( _
>>          sFrom As String, _
>>          sRecipients As String, _
>>          sCC As String, _
>>          sBCC As String, _
>>          sSubject As String, _
>>          sBody As String, _
>>          sSMTPServer As String, _
>>          sSMTPUser As String, _
>>          sSMTPPwd As String, _
>>          sSignature As String, _
>>          sPS As String, _
>>          sAttach As String) As Long
>>     On Error GoTo EH
>>
>>     Dim sContents As String
>>     sBlatFile = CurrentProject.Path & "\blat.bat"
>>     sBlatLog = CurrentProject.Path & "\blat.log"
>>
>>     sContents = "Blat.exe " & sBody & _
>>               " -f " & sFrom & _
>>               " -serverSMTP " & sSMTPServer & _
>>               " -u " & sSMTPUser & _
>>               " -pw " & sSMTPPwd & _
>>               " -tf " & sRecipients & _
>>               " -cf " & sCC & _
>>               " -bf " & sBCC & _
>>               " -sf " & sSubject & _
>>               " -sig " & sSignature & _
>>               " -ps " & sPS & _
>>               " -attach " & sAttach
>>
>>     ' That is  all the varibles, we will now put our constants in, but
>>     ' if you want any of these to be changeable then just make them
>> variables.
>>     ' NB there are no cr/lf in this file.
>>     ' this example asks for a read  receipt, etc.
>>
>>
>>     sContents = sContents & " -noh2 -d -r -dsn sfd -priority 1 -log
blat.log
>> -timestamp -ti 60 -try 3 -hostname MyHostName"
>>
>>     Close 1
>>     On Error Resume Next
>>     Kill sBlatFile
>>     Kill sBlatLog
>>     On Error GoTo EH
>>     Open sBlatFile For Output As #1
>>     Print #1, sContents
>>     Close 1
>> EX:
>>     Close 1
>>     Exit Function
>> EH:
>>     BlatCreate = Err.Number
>>     Select Case BlatCreate
>>     Case Else
>>         MsgBox "Error: " & BlatCreate & vbCrLf & Err.Description
>>     End Select
>>     Resume EH
>> End Function
>>
>> Private Sub sShell(sFile)
>>     Dim strCurPath As String, strCurDrive As String, strProjPath As
String,
>> strProjDrive As String
>>     ' get the project location
>>     strProjPath = CurrentProject.Path
>>     strProjDrive = Left(strProjPath, 1):    'Debug.Print strProjDrive,
>> strProjPath
>>
>>     ' get the current location
>>     strCurPath = CurDir
>>     strCurDrive = Left(strCurPath, 1):    'Debug.Print strCurDrive,
>> strCurPath
>>
>>     ' change the current location to the project location
>>     ' so that we can run the blat.exe via  the blat.bat file
>>     ChDrive strProjDrive
>>     ChDir strProjPath
>>
>>     ' now run the batch file
>>     Shell sFile
>>
>>     ' now restore the current location back to what it was.
>>     ChDrive strCurDrive
>>     ChDir strCurPath
>> End Sub
>>
>>
>>
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list