worsel Newbie
Joined: 12 Nov 2004 Posts: 2
|
Posted: Wed Feb 09, 2005 1:02 am Post subject: Sample: Using blat dll |
|
|
While lurking over the last few months I've noticed a request or two to be able to send email via VDS. I was looking for help using the blat dll; I had been using blat.exe for several years, but had been unsuccessful in attempts to use the dll. Well, I finally succeeded - using blat v2.4.0.
| Code: | #-----------------------------------------------------------------------------#
# #
# Purpose: Try to use the blat! dll #
# #
#-----------------------------------------------------------------------------#
rem First, try using VDS alone.
rem loadlib d:\blat222\full\blat.dll
rem loadlib D:\zzzz\099\Blat240\full\blat
loadlib D:\Blat240\full\blat.dll
#define command,Send
%%msgbody = c:\MsgBody.txt
%%toaddr = john
%%subject = testing testing
rem This command line works!
%%blatcmdstring = "-profile -log c:\blatlog.txt"
rem This command line 'crashes' vds 5.02
%%blatcmdstring = "-"%%msgbody "-to " %%toaddr "-subject "@chr(34)%%subject@chr(34)
rem This command line works.
%%blatcmdstring = %%msgbody -to john.doe@chr(64)fubar.com -subject testing
rem ...but this one doesn't!!!
%%blatcmdstring = %%msgbody -to john.doe -subject testing
rem Does this work. YES!! Must need the full address (duh!) but, why would NOT having the "@..." CRASH vds via the dll???
rem I would expect a return code of 1, rather than a crash!
%%blatcmdstring = %%msgbody -to john.doe@chr(64)fubar.com -subject testing
rem Does this work? YES!
%%blatcmdstring = %%msgbody -to john.doe@chr(64)fubar.com -subject @chr(34)testing testing@chr(34) -log c:\blatlog.txt
rem BUT! This locks it up!
rem %%blatcmdstring = %%msgbody -to john.doe@chr(64)fubar.com -subject @chr(34)testing testing@chr(34)
rem NOW! Let's try the command line to replace the parameters I currently feed blat.exe via a .bat file!
rem note: -r = request return receipt -d = request disposition notification
rem these should work if sent to directly to GroupWise
rem must feed in the %1 info
%1 = john.doe
rem For this one, blat returns "1". (that is, it doesn't work).
%%blatcmdstring = d:\blat\MessageBody_Msg.txt -subject "Important Message" -to %1@chr(64)fubar.com -bcc john.doe@chr(64)fubar.com -attach d:\sbdr\longFile_Name.ext -r -d
rem But this one WORKS!!!
%%blatcmdstring = d:\blat\MessageBody_Msg.txt -subject @chr(34)Important Message@chr(34) -to %1@chr(64)fubar.com -bcc jane.doe@chr(64)fubar.com -attach d:\sbdr\longFile_Name.ext -r -d
rem And, presumably, if any of your filenames have spaces in them, you'd have to do this:
%%blatcmdstring = @chr(34)d:\Message Body.txt@chr(34) -subject @chr(34)Important Message@chr(34) -to %1@chr(64)fubar.com -bcc jane.doe@fubar.com -attach d:\sbdr\longFile_Name.ext -r -d
%a = %%blatcmdstring
%%ptrBcs = @addr("%a")
info "CommandLine:"%a:
%a = %%blatcmdstring
%b = @hex(%a,64)
%c = @addr("%a")
%d = @hex(%c)
info "String:"%a@cr()"Hex of string:"%b@cr()"Addr of string:"%c@cr()"Hex of addr of string:"%d
%%RetCode = @lib(d:\blat222\full\blat.dll,Send,int:,@addr("%a"))
rem %%RetCode = @lib(d:\blat222\full\blat.dll,Send,int:,%%ptrBcs)
rem previous stmt gave "Operation invalid" error
rem I was thinking that I would need to send the address of the command string!
rem Apparently vds @lib() takes care of that?!?
info "DLL Return Code: "%%RetCode@cr()%r |
HTH |
|