Desmond, this is what I do with the recipients emails in a listbox.
Dave
**************
* Start Code
*
lcDll = "blat.dll"
DECLARE INTEGER Send IN (lcDll) STRING blatstring
cSend_To=Alltrim(Thisform.lstSend_To.Value)
cSubject=Alltrim(Thisform.txtSubject.Value)
If Empty(cSubject)
=MessageBox("You MUST put in a subject",0+16,"System Message")
Return
Endif
cFrom=Alltrim("[email protected]")
cMessage="Message From Blat"+Chr(13)+Chr(10)+Thisform.txtMessage.Value
cSMTP="192.168.1.3"
cTemp_File=Addbs(Sys(5)+Sys(2003))+Sys(2015)+".tmp"
StrToFile(cMessage,cTemp_File,0)
lOK=.T.
lnResult=0
*
With Thisform.lstSend_To
For I=1 To .ListCount
If Thisform.lstSend_To.Selected(I)
cSend_To=Alltrim(.ListItem(I,2))
*!!!lcCmd = 'c:\temp\body.txt -t [email protected] -s "e-mail
subject" -f [email protected] -server smtp.wherever.com -attach c:\file.txt'
lcCmd = cTemp_File ;
+' -t '+cSend_To ;
+' -s '+'"'+cSubject +'"';
+' -f '+ cFrom ;
+' -server '+cSMTP
lnResult = Send(lcCmd)
If lnResult<>0
lOK=.F.
*
Exit
*
Endif
Endif
*
Endfor
*
Endwith
*
Delete File (cTemp_File)
*
*************
* End of Code
************
-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Desmond Lloyd
Sent: 01 July 2013 16:38
To: ProFox Email List
Subject: VFP6: Blat.dll woes
Probably a little off subject. But thought I would approach the people on this
list because it is running Blat from within VFP6.
Really odd issue. Have two or three program that send out an email upon the
occurrence of certain events. Has been working fine. Still is on two of my
servers. There are two others that are ran from the individual workstations
that have stopped running, returning an error code, 2 or
1. Have ran portions of the emails that are working in different
environments and they work. Whenever I "adapt" the "sending portion" of the
code to the application they stop!
Have got one running this morning and have gotten it to work on my workstations
and servers and will attempt to adapt, but am concerned I will run into the
same thing...
Anyone seen this before? Perhaps an alternative recommendation for the
generation of these emails. (although everybody seems to love Blat!)
Below is the code I am using: I am thinking it is a server issue, but would
appreciate additional input.
cFrom = '[email protected]'
lcSubject = 'Automated Email Test: 07/01'
set safety off
lcBody = 'This is a Test of an automated email system. Please reply if
received'+ CHR(13) + CHR(10) + CHR(13) + CHR(10) lcRecipient =
'[email protected]'
lcCopyto = '[email protected]'
STRTOFILE(lcbody, "Body.txt")
lcstring = 'Body.txt -s "' + lcsubject + '" -to ' + lcrecipient + ' -f ' +
lcfrom + ' -u '+'bob'+' -pw '+'password'+ ' -server '+'myemailserver'
dll_name = 'blat.dll'
EXTERNAL PROCEDURE "Send"
DECLARE INTEGER Send in "&dll_name" STRING blatstring lnresult = send(lcstring)
IF lnresult > 0 wait window 'Result: '+alltrim(str(lnREsult)) ENDIF
Regards,
Desmond
.
--- StripMime Report -- processed MIME parts --- multipart/alternative
text/plain (text body -- kept)
text/html
---
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.