This is an old revision of the document!
Tested with opsi 4.0.2
required WInst Version: unknown
By Frank Thommen, 2014/01/10 11:13
This script requires blat which can be downloaded from http://www.blat.net/
if ($_mail.msgtype = "file")
WinBatch_SendMailFromFile
else
if ($_mail.msgtype = "stringlist")
; avoid error message in case this function is used more then once
; within script
ScriptErrorMessages = off
DefVar $__mail.msgfile
ScriptErrorMessages = on
; Create temporary filename and encode to get rid of
; special characters which might not be allowed in filenames
Set $__mail.msgfile = "C:\tmp\" + base64EncodeStr(RandomStr)
; and also get rid of "=" which also screws uup things
Set $__mail.msgfile = stringReplace($__mail.msgfile, "=", "") + ".tmpmail"
if ( FileExists($__mail.msgfile) )
PAUSE "ERROR: File " + $__mail.msgfile + " already exists. Please inform XYZ about this error"
else
for %s% in $_mail.msgstrlist do DosInAnIcon_DumpToFile
if NOT( FileExists($__mail.msgfile) )
PAUSE "ERROR: Mailfile " + $__mail.msgfile + " could not be created. Please inform XYZ about this error"
else
WinBatch_SendMailFromLocalFile
Files_DeleteMsgFile
endif
endif
else
if ($_mail.msgtype = "string")
WinBatch_SendMailFromString
else
PAUSE "ERROR: Unknown Messagetype! Please inform structures-it@embl.de about this error"
endif
endif
endif
;
; ----------------------------------------------------------
;
[DosInAnIcon_DumpToFile]
echo %s% >> $__mail.msgfile
[Files_DeleteMsgFile]
del -f "$__mail.msgfile"
[WinBatch_SendMailFromFile]
"%SCRIPTPATH%\..\global\blat311\bin\blat.exe" "$_mail.msgfile" -serverSMTP <your_smtp_server_goes_here> -f "Your Name <yourm@il>" -to "Your Name <yourm@il>" -subject "$_mail.msgsubject"
[WinBatch_SendMailFromString]
"%SCRIPTPATH%\..\global\blat311\bin\blat.exe" - -serverSMTP <your_smtp_server_goes_here> -f "Your Name <yourm@il>" -to "Your Name <yourm@il>" -subject "$_mail.msgsubject" -body "$_mail.msgstring"
[WinBatch_SendMailFromLocalFile]
"%SCRIPTPATH%\..\global\blat311\bin\blat.exe" "$__mail.msgfile" -serverSMTP <your_smtp_server_goes_here> -f "Your Name <yourm@il>" -to "Your Name <yourm@il>" -subject "$_mail.msgsubject"