This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
userspace:lib.sendmail [2014/01/10 16:13] embl-structures |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Library: SendMail ====== | ||
| - | |||
| - | |||
| - | Tested with opsi 4.0.2\\ | ||
| - | required WInst Version: // | ||
| - | By //Frank Thommen, 2014/01/10 11:13// | ||
| - | |||
| - | This script requires blat which can be downloaded from http:// | ||
| - | |||
| - | Usage instructions see below | ||
| - | |||
| - | Tree:\\ | ||
| - | < | ||
| - | %SCRIPTDRIVE%\lib\ | ||
| - | ├ UseSendMail.sub | ||
| - | ├ SendMail_Variables.opsiinc | ||
| - | ├ SendMail_Functions.opsiinc | ||
| - | └ blat311\ | ||
| - | ├ docs\ | ||
| - | | ||
| - | └ bin\ | ||
| - | ├ blatdll.h | ||
| - | ├ blat.lib | ||
| - | ├ blat.dll | ||
| - | └ blat.exe | ||
| - | </ | ||
| - | |||
| - | |||
| - | |||
| - | === UseSendMail.sub === | ||
| - | <code winst> | ||
| - | ; | ||
| - | ; ----------------------------------------------------------- | ||
| - | ; UseSendMail.sub - send file, string or stringlist as mail | ||
| - | ; ----------------------------------------------------------- | ||
| - | ; | ||
| - | ; AUTHOR: Frank Thommen, EMBL Heidelberg | ||
| - | ; SHORTNAME (for variable names): mail | ||
| - | ; | ||
| - | ; PREREQUISITE: | ||
| - | ; | ||
| - | ; | ||
| - | ; PURPOSE: Send a mail using " | ||
| - | ; can be taken from | ||
| - | ; | ||
| - | ; * a stringlist (each element will become a line | ||
| - | ; of the mailbody | ||
| - | ; * a string (this will result in a one-line mail) | ||
| - | ; * a textfile (the content will become the mailbody) | ||
| - | ; | ||
| - | ; The mail subject is user-defined, | ||
| - | ; destination address are harcoded in this version. | ||
| - | ; Therefore this version rather qualifies for sending | ||
| - | ; status mails to a fixed address rather than being a | ||
| - | ; freely configurable mailer. | ||
| - | ; be achieved by adding more user-definable variables. | ||
| - | ; | ||
| - | ; | ||
| - | ; USAGE: | ||
| - | ; Sub " | ||
| - | ; Set $_mail_subject = "Your Mail Subject" | ||
| - | ; | ||
| - | ; Set $_mail.msgtype = " | ||
| - | ; Set $_mail.msgstrlist = <some stringlist cmd> | ||
| - | ; or | ||
| - | ; Set $_mail.msgtype = " | ||
| - | ; Set $_mail.msgstring = " | ||
| - | ; or | ||
| - | ; Set $_mail.msgtype = " | ||
| - | ; Set $_mail.msgfile = " | ||
| - | ; | ||
| - | ; Sub_SendMail | ||
| - | ; | ||
| - | ; | ||
| - | ; HISTORY: 10-JAN-2014: | ||
| - | ; | ||
| - | ; | ||
| - | |||
| - | include_insert " | ||
| - | include_append " | ||
| - | </ | ||
| - | |||
| - | |||
| - | === SendMail_Variables.opsiinc === | ||
| - | <code winst> | ||
| - | DefVar $_mail.msgtype | ||
| - | DefStringList $_mail.msgstrlist | ||
| - | DefVar $_mail.msgstring | ||
| - | DefVar $_mail.msgfile | ||
| - | DefVar $_mail.msgsubject | ||
| - | </ | ||
| - | |||
| - | |||
| - | === SendMail_Functions.opsiinc === | ||
| - | <code winst> | ||
| - | [sub_SendMail] | ||
| - | if ($_mail.msgtype = " | ||
| - | WinBatch_Mail_SendMailFromFile | ||
| - | else | ||
| - | if ($_mail.msgtype = " | ||
| - | ; 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 = " | ||
| - | |||
| - | if ( FileExists($__mail.msgfile) ) | ||
| - | PAUSE " | ||
| - | else | ||
| - | for %s% in $_mail.msgstrlist do DosInAnIcon_Mail_DumpToFile | ||
| - | if NOT( FileExists($__mail.msgfile) ) | ||
| - | PAUSE " | ||
| - | else | ||
| - | WinBatch_Mail_SendMailFromLocalFile | ||
| - | Files_Mail_DeleteMsgFile | ||
| - | endif | ||
| - | endif | ||
| - | else | ||
| - | if ($_mail.msgtype = " | ||
| - | WinBatch_Mail_SendMailFromString | ||
| - | else | ||
| - | PAUSE " | ||
| - | endif | ||
| - | endif | ||
| - | endif | ||
| - | |||
| - | ; | ||
| - | ; ---------------------------------------------------------- | ||
| - | ; | ||
| - | |||
| - | [DosInAnIcon_Mail_DumpToFile] | ||
| - | IF NOT " | ||
| - | ECHO %s% >> " | ||
| - | ) ELSE ( | ||
| - | ECHO. >> " | ||
| - | ) | ||
| - | |||
| - | |||
| - | [Files_Mail_DeleteMsgFile] | ||
| - | del -f " | ||
| - | |||
| - | |||
| - | [WinBatch_Mail_SendMailFromFile] | ||
| - | " | ||
| - | |||
| - | |||
| - | [WinBatch_Mail_SendMailFromString] | ||
| - | " | ||
| - | |||
| - | |||
| - | [WinBatch_Mail_SendMailFromLocalFile] | ||
| - | " | ||
| - | </ | ||
| - | |||