REVO2700SMTP3Hf 4SMTP library demo  UArial UArial WArial ULucida Grande UMonaco UMonaco U HelveticaU Helvetica U Courier New UApple ChanceryUApple Chancery UArial UBookman Old StyleUArial"UArial"WArial @UArialcGlx2TimeStamp checksumcREVGeometryCachestackID1043cRevStandaloneSettings9scriptLibraries Internet MacOSXfalse OSX,nameSMTPMacOS,documentTypeUNIX,fileSelectortrueWindowsfalseMacOS,longVersion SMTP 1.0.0.0Windows,LegalCopyright#2004 All rights reserved worldwideUNIX,pageSetuptrueOSX,documentTypeLinuxfalseWindows,documenticonFile8/Applications/Revolution 2.5/Sample Icons/genericdoc.ico inclusionsselectOdtfalse answerDialogtrueSPARCfalseOSX,documentExtension SolIntelfalseWindows,FileDescriptionSMTP 1.0.0.0 for WindowsOSX,longVersion SMTP 1.0.0.0 MacOSfatfalseUNIX,printerChoosertrueOSX,copyright#2004 All rights reserved worldwideMacOS,MinimumSize15000MacOS,versionnumber11MacOS,ReleaseFinalMacOS,versionnumber20MacOS,versionnumber30nameSMTP MacOS,Region1rs6000falseHp9k700falseOSX,shortVersion1.0.0.0Windows,fileversion11Windows,fileversion20Windows,productversion11Windows,fileversion30Windows,productversion20Windows,fileversion40Windows,productversion30cursorsfalseBsdfalse OSX,infoSMTP Version 1.0.0.0Windows,productversion40 MacOS68kfalseMacOS,dynamicMemorytrue askDialogtrueIrisfalseWindows,iconFile8/Applications/Revolution 2.5/Sample Icons/genericapp.icoOSX,signature????Windows,ProductNameSMTPMacOS,PreferredSize15000UNIX,colorChoosertrue MacOSPPCtrueMacOS,creator???? SolSparcfalseWindows,companyname cREVGeneral debugObjects P5-- remove all stored data, putting in example data instead -- on clearAll put "smtp.myisp.com" into fld "Server" set the hilite of btn "Auth" to false set the enabled of grp "Auth group" to false put empty into fld "User" put empty into fld "Pass" put "recipient@yourisp.com" into fld "To" put "sender@myisp.com" into fld "From" put "subject" into fld "Subject" put empty into fld "Attach" put "Type your email here." into fld "Body" put empty into fld "Status" put empty into fld "Log" set the hilite of btn "Debug" to true end clearAll  cGlx2GeneralcScriptChecksumcExplicitVariablescHscrollScript0cLocalscHscrollHandlers0 cHtmlScript}N0 } +gG@B8 m{O#!iږS<5 ,YV~TT]7O,8+&=Xv7$ɓ46}L5[2{ b*#ht)(@fWt438|UAX ǔtj/-ifKAs,r!lF)ߤ+X/z߯v܏kÜ@ `s]%QH}?xEWvU :zAkpEcSelectedChunk char 81 to 91 cConstantscHandlersListWidth119 cDirtyFlagfalsecHtmlHandlersc)I). EɶJƆƖJv6 qĜļԢb}B;.;5eKk4f&p9E99 .j cFolders all handlers cHandlersclearAllcVscrollScript0cVscrollHandlers0 cHilitedLine cGlobalscGlx2TimeStamp 1247139761start checksumEA=Rـ 1240737588startcREVGeometryCacheIDs10760499082111029107604916895910051240614393953104310760491695041015107604968021010271076049169344101210760490903871004107604945982810221076050598725103510760491691481008107604916974210171076377183437104110760500254841030107604941021010201076049459787102110760491694331014107604946471510251076049410170101910760491697511018107605028845310331076049464755102610763771658271040107604916928010111076050050374103110760496906611028107604946290910231076049169090100710760494629511024cREVGeometrycacheorder total28 cREVGeneral  LibraryEx~on mouseUp set the menuHistory of btn "Tabs" of stack "sSMTPlibrary" to 1 go to cd 1 of stack "sSMTPlibrary" end mouseUp z 6,2cGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049090387  To label cWcGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049168959 To:  Subj label WcGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049169090 Subject:  Attach label WcGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049169433 Attachments:AddCPon mouseUp answer file "Select an attachment:" --with filter "TEXT,Text files,*.txt" if it is not empty then put it & cr after fld "Attach" end mouseUp   cGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049169742 RemoveCPon mouseUp if the hilitedLine of fld "Attach" is not empty then put the hilitedLine of fld "Attach" into lineNum delete line lineNum of fld "Attach" end if end mouseUp 8  cGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049169751  From label WcGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049410170 From:  Server label  WcGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049464715 SMTP server:Auth`eRon mouseUp set the enabled of grp "Auth group" to the hilite of me end mouseUp 4.d& AuthenticatecGlx2TimeStamp checksum cREVGeneral revUniqueID 1076049690661  Send emailEx --> all handlers on mouseUp disable me connectToServer end mouseUp -- main connection handler -- on connectToServer -- start using SMTP library if necessary if the stacksinuse contains "sSMTPlibrary" is false then start using stack "sSMTPlibrary" end if put the hilite of btn "Debug" into debugOn put empty into fld "Log" -- check for incomplete SMTP server & email data if checkData("SMTP") = false then enable me exit connectToServer end if -- specify the fields to be used for logging -- these commands must get "the long name" of the relevant fields if the hilite of btn "Debug" then put "verbose" into transcriptSet else put "plain" into transcriptSet end if sSMTPsetTranscriptField the long name of fld "Log", transcriptSet sSMTPsetStatusField the long name of fld "Status" enable btn "Stop" sSMTPconnectToServer fld "Server", "sendEmails", the hilite of btn "Auth", fld "User", fld "Pass" end connectToServer -- callback handler after connection -- if OK, sends the email -- otherwise, reports the error and exits -- on sendEmails pState if pState <> "OK" then answer "Connection error: " & pState sSMTPdisconnectFromServer disable btn "Stop" enable me else put the hilite of btn "HTML" into tUseHTML put assembleBody(tUseHTML) into tBody put sSMTPbuildEmailText(fld "From", fld "To", fld "Subject", \ tBody, fld "Attach", tUseHTML) into tBody sSMTPsendMessage fld "From", fld "To", fld "Subject",\ tBody, "messageSent", fld "Attach" end if end sendEmails -- utility function to find the correct format of text to include as the body of the email -- function assembleBody pUseHTML if pUseHTML then -- see if the text is formatted, or whether html has been typed in if fld "Body" contains "" then return the text of fld "Body" else return the htmltext of fld "Body" end if else return the text of fld "Body" end if end assembleBody -- callback handler after sending email -- if not OK, reports the error -- disconnects from server no matter what -- on messageSent pState if pState <> "OK" then answer "Mail sending error: " & pState sSMTPdisconnectFromServer disable btn "Stop" enable me end messageSent -- function to check that all relevant preferences have been entered -- function checkData put empty into badData if fld "Server" is empty then put tab & "SMTP server" & cr into badData if the hilite of btn "Auth" then if fld "User" is empty then put tab & "User name" & cr after badData if fld "Pass" is empty then put tab & "Password" & cr after badData end if if fld "To" is empty then put tab & "To" & cr into badData if fld "From" is empty then put tab & "From" & cr into badData if fld "Subject" is empty then put tab & "Subject" & cr into badData if badData is not empty then answer error "The following data is missing or invalid:" & cr & badData return false else return true end if end checkData  ,S cGlx2GeneralcScriptChecksumcExplicitVariablescHscrollScript0cLocalscHscrollHandlers0 cHtmlScript7VMo8W t(R E٢@^(ids"J3#Jd]IyȇGPIڠк>nuPAhQ^+g-V_֓nv҄i IN!*a|F^3C1PK1# PM2d@VrU|oG{FG@-OXGd_dmRcj(c!R )|lZODOMj/tX,57M(lH=PFѶ4m"1BQj_ </~GlPdɶ!Dxp3{pDGp aّ'G3j A)"P1k'u}<ъx #?T kȶH$J-i?j"7:_$ЗW7F9ӺD%Bv$s qkpxu*G?@A(ÙIʖ]m\VZ4#pcK|7ZOqa-ɗ6C+q7>^`Ɵ'ϑԐq3Dj[?(OE;bG'L>rv7 UQT&$z.%1|t!'(f"#b}D~Sl $H;V=C$Ȏ?<9f]1-Y#(M2od.\[ZNR@ϭW1Lƽ̤/| O]U겡,ȕjmPMgiAKWhE^zD\~.T,'"wݨUhI1O!y9*$ all handlers local sConnectOK, sSocketAddr, sSmtpUser, sSmtpPass, sAuthNeeded local transcriptPlain, transcriptVerbose local callBackHandler, callBackTarget local transcriptField, transcriptType, statusField -- connect to SMTP server, authenticating if necessary -- and return to the callback function -- on sSMTPconnectToServer pServer, pCallBack, pUseAuth, pUser, pPass sSMTPshowStatus "Connecting to SMTP server..." put false into sConnectOK put empty into transcriptPlain put empty into transcriptVerbose put pCallBack into callBackHandler put the long name of the target into callBackTarget if pUser is not empty and pPass is not empty and pUseAuth = true then put true into sAuthNeeded put pUser into sSmtpUser put pPass into sSmtpPass else put false into sAuthNeeded end if -- close any open sockets - resetAll if there are any problems repeat until the opensockets is empty close socket line 1 of the opensockets if the result is not empty then resetAll exit repeat end if end repeat -- get account address & convert to numeric IP address -- hostnameToAddress function just returns the number -- if the entered server was already a number, so either will work -- hostnameToAddress() may return more than one line, so just pick a random one put any line of hostnametoaddress(pServer) into smtpServer if smtpServer is empty then sSMTPaddToTranscript "SMTPerror" && smtpServer & " could not be found", "all" sSMTPshowStatus "" sSMTPexitSMTP "noconnect" end if -- set up timeout check in case connection fails set the sockettimeoutinterval to 20000 -- 20 seconds send "sSMTPcheckTimeout" to me in 10 seconds -- open SMTP port, using port number 25 if no port number has been specified if smtpServer contains ":" is false then put ":25" after smtpServer put smtpServer into sSocketAddr open socket to sSocketAddr with message "sSMTPsocketConnected" if the result is not empty then sSMTPaddToTranscript "SMTPerror can't make connection to " & sSocketAddr, "all" put empty into sSocketAddr sSMTPexitSMTP "noconnect" end if end sSMTPconnectToServer function sSMTPbuildEmailText pSender, pRecip, pSubject, pBody, pAttach, pUseHTML -- if pUseHTML is true, pBody will contain htmlText only (no plain text) sSMTPshowStatus "Constructing email: " & pSubject put empty into emailText if pUseHTML = true or pAttach is not empty then -- multipart divider headers put "_NextPart_" & the seconds & "." & the ticks into partMarker put "_NextPart_" & the seconds+1 & "." & the ticks into partMarker2 if pUseHTML = true then put "Content-Type: multipart/alternative; boundary=" & partMarker & CRLF into attachHeaders put "Content-Type: multipart/mixed; boundary=" & partMarker2 & CRLF into tExtraHeader else put "Content-Type: multipart/mixed; boundary=" & partMarker & CRLF into attachHeaders put empty into tExtraHeader end if put "" & CRLF after attachHeaders put "This is a multipart message in MIME format." & CRLF after attachHeaders put "" & CRLF after attachHeaders put "--" & partMarker & CRLF after attachHeaders else put empty into attachHeaders end if repeat for each line L in pRecip if L is empty then next repeat put "To: " & L & CRLF after toHeaders end repeat put "Mime-Version: 1.0" & CRLF after emailText put "X-Mailer: sSMTPlibrary (" & the cVersionNum of stack "sSMTPlibrary" & ")" & CRLF after emailText put toHeaders after emailText put "From: " & pSender & CRLF after emailText put "Subject: " & pSubject & CRLF after emailText put "Date: " & the internet date & CRLF after emailText put attachHeaders after emailText -- if using HTML text, assemble the plain text form & the html form with the appropriate dividers if pUseHTML = true then -- plain text put "Content-Type: text/plain; charset=US-ASCII; format=flowed" & cr after tNewBody put "Content-Transfer-Encoding: 7bit" & cr & cr after tNewBody set the htmltext of the templatefield to pBody put the text of the templatefield into tPlain put tPlain & cr after tNewBody if pAttach is not empty then -- indicate switching from alternative to mixed, with change of part marker put cr & cr & "--" & partMarker & cr after tNewBody put tExtraHeader & cr & cr after tNewBody put partMarker2 into partMarker end if -- formatted text put cr & cr & "--" & partMarker & cr after tNewBody put "Content-Type: text/html; charset=US-ASCII" & cr after tNewBody put "Content-Transfer-Encoding: 7bit" & cr & cr after tNewBody if char 1 to 6 of pBody <> "" then put "" before pBody if char -7 to -1 of pBody <> "" then put "" after pBody put pBody & cr after tNewBody put tNewBody into pBody else put "Content-Type: text/plain; charset=US-ASCII" & CRLF after emailText put "Content-Transfer-Encoding: 7bit" & CRLF after emailText put "" & CRLF after emailText end if -- period is the terminating character, so make sure it doesn't occur singly repeat for each line L in pBody if char 1 of L = "." then put "." & L & CRLF after emailText else put L & CRLF after emailText end repeat repeat for each line L in pAttach put "" & CRLF after emailText put CRLF & "--" & partMarker & CRLF after emailText set the itemdel to "/" put last item of L into shortName set the itemdel to comma put "Content-Disposition: attachment; filename=" & quote & shortName & quote & CRLF after emailText put "Content-Transfer-Encoding: base64" & CRLF after emailText put "Content-Type: application/octet-stream; name=" & quote & shortName & quote & CRLF after emailText put "" & CRLF after emailText open file L for binary read read from file L until EOF put base64encode(it) after emailText close file L end repeat if pAttach is not empty then put "" & CRLF & "--" & partMarker after emailText put "" & CRLF after emailText return emailText end sSMTPbuildEmailText on sSMTPsendMessage pSender, pRecip, pSubject, pBody, pCallback, pAttach sSMTPshowStatus "Sending email: " & pSubject put pCallBack into callBackHandler put the long name of the target into callBackTarget -- check that email text has been formatted OK if pBody contains "Content-Type:" is false then sSMTPexitSMTP "TextNotFormatted" end if sSMTPsendReceive "MAIL FROM: <" & sSMTPextractEmail(pSender) & ">" repeat for each line L in pRecip if L is empty then next repeat sSMTPsendReceive "RCPT TO: <" & sSMTPextractEmail(L) & ">" end repeat sSMTPsendReceive "DATA" -- pBody has been pre-formatted with correct encoding, headers etc sSMTPsendOnly pBody -- or if you want to send the data in segments -- repeat until pBody is empty -- sSMTPsendOnly line 1 to 5000 of pBody -- delete line 1 to 5000 of pBody -- end repeat sSMTPsendReceive CRLF & "." sSMTPsendCallback "OK" end sSMTPsendMessage -- stop if user has clicked a stop button -- on sSMTPcancelConnection -- cancel timeout message sSMTPcancelTimeout sSMTPshowStatus "" put empty into sSocketAddr resetAll sSMTPaddToTranscript "SMTPerror socket connection stopped", "all" sSMTPexitSMTP "cancel" end sSMTPcancelConnection -- disconnect from SMTP server -- on sSMTPdisconnectFromServer sSMTPexitSMTP "disconnect" end sSMTPdisconnectFromServer -- diagnostic functions to set where to display a transcript -- from the server (either verbose or short) -- and a status line for each operation -- on sSMTPsetTranscriptField pField, pType if there is a pField then put pField into transcriptField else put empty into transcriptField end if if pType = "verbose" then put "verbose" into transcriptType else put "plain" into transcriptType end if end sSMTPsetTranscriptField on sSMTPsetStatusField pField if there is a pField then put pField into statusField else put empty into statusField end sSMTPsetStatusField -- PRIVATE FUNCTIONS AND HANDLERS CALLED BY HANDLERS ABOVE -- USERS DO NOT NEED TO USE THESE ROUTINES DIRECTLY, -- BUT THEY DO NEED TO BE KEPT WITH THE REST OF THE LIBRARY -- check socket connection after opening -- on sSMTPsocketConnected -- cancel timeout message sSMTPcancelTimeout -- read the welcome message from the server read from socket sSocketAddr until CRLF sSMTPaddToTranscript it, "all" if char 1 of it = "2" then put true into sConnectOK sSMTPsendHello else sSMTPexitSMTP "badconnect" end if end sSMTPsocketConnected -- once connection is made, cancel any pending timeout mesage -- on sSMTPcancelTimeout put the pendingmessages into pendMess repeat for each line L in pendMess if L contains "sSMTPcheckTimeout" then cancel item 1 of L end repeat end sSMTPcancelTimeout -- add information to server transcript -- on sSMTPaddToTranscript pData, pSet if last char of pData <> cr then put cr after pData put pData after transcriptVerbose if pSet = "all" then put pData after transcriptPlain if transcriptField is not empty then if transcriptType = "verbose" then do "put transcriptVerbose into " & transcriptField else do "put transcriptPlain into " & transcriptField set the vscroll of transcriptField to 999999 end if end sSMTPaddToTranscript -- display current status line -- on sSMTPshowStatus pStatus if statusField is not empty then do "put pStatus into " & statusField end sSMTPshowStatus -- send EHLO or HELO message and read server capabilities -- on sSMTPsendHello sSMTPsendOnly "EHLO " & hostaddress(sSocketAddr) put empty into firstRead repeat read from socket sSocketAddr until CRLF sSMTPaddToTranscript it if firstRead is empty then put it into firstRead if it contains "AUTH" then put it into authHeader put it into tRead if char 4 of tRead <> "-" then exit repeat end repeat if char 1 of firstRead <> 2 then -- use old HELO instead sSMTPsendReceive "RSET" sSMTPsendReceive "HELO " & hostaddress(sSocketAddr) end if if sAuthNeeded = true and authHeader is not empty then sSMTPsendAuthMethod authHeader else sSMTPsendCallback "OK" end if end sSMTPsendHello -- function to return the stripped email address -- e.g. if sent "Joe Bloggs" -- returns joe.bloggs@isp.com -- function sSMTPextractEmail pAddress put wordoffset("@", pAddress) into wordNum put word wordNum of pAddress into tEmailAddress replace "<" with "" in tEmailAddress replace ">" with "" in tEmailAddress return tEmailAddress end sSMTPextractEmail -- check what sort of authorisation is supported -- encode data if necessary, then start sending -- on sSMTPsendAuthMethod pMethod sSMTPshowStatus "Authenticating..." put empty into authMethod if pMethod contains "LOGIN" then put "AUTH LOGIN" into authMethod put base64encode(sSmtpUser) into sSmtpuser put base64encode(sSmtpPass) into sSmtpPass else if pMethod contains "PLAIN" then put "AUTH PLAIN" into authMethod put space & base64encode(sSmtpUser & numtochar(0) & sSmtpUser & numtochar(0) & sSmtpPass) after authMethod end if -- authentication method not supported if authMethod is empty then sSMTPsendCallback "NotAuthenticated" sSMTPaddToTranscript "-> " & authMethod if word 2 of authMethod = "PLAIN" then -- PLAIN contains the login data in the method line sent -- so don't need to send user & password after sending method write authMethod & CRLF to socket sSocketAddr with message sSMTPauthDataSent else write authMethod & CRLF to socket sSocketAddr with message sSMTPsendUser end if end sSMTPsendAuthMethod -- send user data -- on sSMTPsendUser sSMTPshowStatus "Sending user name..." sSMTPreadData "Method" -- reading response to METHOD, only gets back if data OK sSMTPaddToTranscript "-> " & sSmtpUser, "all" write sSmtpUser & CRLF to socket sSocketAddr with message sSMTPsendPass end sSMTPsendUser -- read response from user data sent -- if not OK, readData exits, so once it gets back here, continue with sending password -- on sSMTPsendPass sSMTPshowStatus "Sending password..." sSMTPreadData "User" -- reading response to USER, only gets back if data OK sSMTPaddToTranscript "-> ********", "all" -- sSMTPaddToTranscript "-> " & sSmtpPass, "all" write sSmtpPass & CRLF to socket sSocketAddr with message sSMTPauthDataSent end sSMTPsendPass -- authentication data has now all been sent -- read the next message from the server , -- it will exit automatically if there was an error -- otherwise send an OK to the connection callback handler -- on sSMTPauthDataSent -- read response to password -- if wrong, it won't return sSMTPreadData "Pass" -- reading response to PASS sSMTPsendCallback "OK" end sSMTPauthDataSent -- this handler uses the callback message to report the number of emails -- if there is an error, it is used to send back a 0 -- so that subsequent checks can be scheduled -- on sSMTPsendCallback pState put "send " & quote & callBackHandler && pState & quote & " to " & callBackTarget into cmd try do cmd catch errMsg sSMTPaddToTranscript "SMTPerror callback error: " & errMsg, "all" sSMTPexitSMTP "badcallback" end try end sSMTPsendCallback -- this routine sends data to the server and reads the response -- SMTP responses always start with +OK or -ERR -- on sSMTPsendReceive pData if pData contains "PASS" then sSMTPaddToTranscript "-> PASS ********" else sSMTPaddToTranscript "-> " & pData end if write pData & CRLF to socket sSocketAddr sSMTPreadData word 1 of pData end sSMTPsendReceive -- this routine is for sending only, with no response expected -- on sSMTPsendOnly pData if the number of lines in pData < 10 then sSMTPaddToTranscript "-> " & pData, "all" end if write pData & CRLF to socket sSocketAddr end sSMTPsendOnly -- this routine is for reading only -- if there is an error, it closes the port & exits -- on sSMTPreadData pWhat repeat read from socket sSocketAddr until CRLF sSMTPaddToTranscript it, "all" if char 4 of it <> "-" then exit repeat end repeat if it is empty or char 1 of it is in "54" then sSMTPaddToTranscript "SMTPerror closing socket due to error reading " & pWhat, "all" -- don't allow infinite loop of unanswered QUITs if pWhat = "QUIT" then put empty into sSocketAddr sSMTPexitSMTP "badread" end if end sSMTPreadData -- close socket if still open, -- tell callback handler unless it is an expected closure -- on sSMTPexitSMTP pReason sSMTPcancelTimeout sSMTPshowStatus "" if sSocketAddr is not empty and pReason <> "noconnect" then sSMTPsendReceive "QUIT" close socket sSocketAddr put empty into sSocketAddr end if put empty into sSmtpUser put empty into sSmtpPass if pReason <> "disconnect" and pReason <> "cancel" and pReason <> "badcallback" then sSMTPsendCallback pReason exit to top end if end sSMTPexitSMTP -- these handlers are just to catch any connection failure -- on sSMTPcheckTimeout put empty into sSocketAddr resetAll sSMTPaddToTranscript "SMTPerror timeout opening socket", "all" sSMTPshowStatus "" sSMTPexitSMTP "noconnect" end sSMTPcheckTimeout on socketTimeOut put empty into sSocketAddr resetAll sSMTPaddToTranscript "SMTPerror socket time out", "all" sSMTPshowStatus "" sSMTPexitSMTP "timeout" end socketTimeOut on socketError sockID, errMsg put empty into sSocketAddr resetAll sSMTPaddToTranscript "SMTPerror socket error: " & errMsg, "all" sSMTPshowStatus "" sSMTPexitSMTP "error" end socketError on socketClosed sockID put empty into sSocketAddr end socketClosed -- for information display formatting only -- on preOpenCard if the short name of this stack = "sSMTPlibrary" then set the scroll of fld "Docs" to 0 pass preOpenCard end preOpenCard -- these handlers are not part of the library -- but are here to allow for stack resizing -- on changeRect pObj, newL, newT, newR, newB put the rect of pObj into tRect if newL is not empty then put newL into item 1 of tRect if newT is not empty then put newT into item 2 of tRect if newR is not empty then put newR into item 3 of tRect if newB is not empty then put newB into item 4 of tRect set the rect of pObj to tRect end changeRect on resizeStack newW, newH if the short name of this stack = "sSMTPlibrary" then changeRect the long name of btn "Tabs", , ,newW - 10, newH - 10 changeRect the long name of fld "Docs", , ,newW - 20, newH - 20 end if end resizeStack 4Sarah's SMTP library U helveticaWArial WArial @UArial UArial ULucida GrandeWLucida Grande WLucida Grande ULucida GrandeUArialULucida Grande UArial cGlx2GeneralcScriptChecksumcExplicitVariablescHscrollScript0cLocalssConnectOK sSocketAddr sSmtpUser sSmtpPass sAuthNeeded transcriptPlain transcriptVerbose callBackHandler callBackTarget transcriptField transcriptType statusFieldcHscrollHandlers0 cHtmlScript;iWI+/ l}uF0 OJTTYSeOy!awq7HyFƝ;gx$e5ejgPy.Q-'IRm]|xW|4㝔LuպL>kU+UI=+6,A֝ާ2KOn*cfEvy/Oz ʼNq"&*.p!JY7e3a(pĦur6R9ջ,ՂBoS\SG?al$xQ4&ESMUR9qd}r[Oע"a-"ALyBm&4)yy@9!BȕOioF.x 0.<4z#6:y;۩"3DK7Ho }$27U ; b)ᧄA%,J,e!Z4a1k Fo}"Ks)^{h(4YPXW95k h1%.h.)rק_#~ M hNh5[;np !Q 2&4pxZUM|ڠ>nB@aO_j[hcY*đٵ^٢-0?GFwg}FUb?֨~=82%O'M܀1zG °A AJn!!d).P)§u*LmrZk% xI Mvn_Ƽ;kxUx#~\^a2eDd(4l𶏮Iٝ Mag,j S`Zay0@#\xY'Lq@ ֠5U|çazYZFDȜNk#@C܌e}z(ID3. e%7x,zk_{]41l]btݫ1_Z/!Ebotx!T%tA URnӜÇx_mKSR#JVxRuWA=rGJ̔ @\ =Ɵge<4Wth4iAiOI *JkP1wne(|- Q o.hiz{þ^ZPYǼp3~΢% 9cIZT0/ ڷvu{x!WUmvb&ŎR_y+-Q)~sY8WAؤcg^o2̨B' T#ҕ0ZdNҨYg;hYޕ@wW4 wuͭ4]9r]=-\>>ˆby N:is>LvN1.b>\'߹LzW;BCaj+UNfKn @5~ !mNU7 +ثZ+8a`O j&A;0m<>=Scw y 8_/A_GӲ \eoE6 4=q%p ՓH~b\f]:5`,ԫ#uu!)މ&uRK(zW$pfmAyGkֽ֝3t, D00觇[2nDƺ(0aV!TTQv .k`D;nnb0{:<݁aǠ?v^ E"2bTM5Q6m˞W*R8}7IPx6zenf}}׾-NOX։j=uX9*IA {@ d CGlk*1E~w18߮]M|"#].nzQwQxi6F;oMq*L}2rOQب\&tr)jхڋ:JU}uԠޏ3[0HVuT]ݧ{ qx`&bTXK9 Dςڈ7 B+T^Qv]pF w G`0=O{^\#o-,2 (H6I܁1pB|` *rۤzsh h.RJEx>KD~vCD3ƗP0=aMPw`@APdKv& / yr%*ot]ZIGb}wPt8:4':]0"dߣ,af,~Ly8HDP _DIer0}Fvt2:NՈ-奪fU6蔒;Ua4+4= ]͛K۽k+u<Z03k[$W]rb"1 Gfa7/lTx@x`"aF2/Zرt)~{ X 3X屗rǭS"]weSġ>YҐ6>_-?Ȫ@ 4ߤ98S@xѣptꅄB0TwgEpc,y-csB"-JZSG S1qim{:R!%/KlJ}݋p+QAf_Xj@cpݷM=vb^DS02Dz+jzI/&WZZ}(<&a;'[.KeMO`ĥXM|)Dnt K(}qs~靃Nq2c-“t n̘I8E)gTq:mҖ~~.`BYMl2p/պ"Otn}HQQ.B[>! B-P7ir9Hn~C 1nSk15܅]r3fug·gνٝy><ܛ?Ӑ6a -rA#^}5or&jopK1'pq8{ZJ~CcSelectedChunk char 2 to 1 cConstantscHandlersListWidth225 cDirtyFlagfalsecHtmlHandlersbJ@} zUJT(ƀoJ003?O) Mn9gE+r5 y̲l/|ڿHOi[\mq}5Gw/ښbtDRһyl ?V3Ffأlb(ŠĭftFrz?GPQKWc'JrmuT+z\%GGzRG}} v He@AݓE#;0tGm{r#TIjsR9crfmؒ(j,3Y3ZMaL1u[7= cFolders all handlers cHandlerschangeRect preOpenCard resizeStack socketClosed socketError socketTimeOut sSMTPaddToTranscript sSMTPauthDataSent sSMTPbuildEmailText() sSMTPcancelConnection sSMTPcancelTimeout sSMTPcheckTimeout sSMTPconnectToServer sSMTPdisconnectFromServer sSMTPexitSMTP sSMTPextractEmail() sSMTPreadData sSMTPsendAuthMethod sSMTPsendCallback sSMTPsendHello sSMTPsendMessage sSMTPsendOnly sSMTPsendPass sSMTPsendReceive sSMTPsendUser sSMTPsetStatusField sSMTPsetTranscriptField sSMTPshowStatus sSMTPsocketConnectedcVscrollScript0cVscrollHandlers0 cHilitedLine cGlobalscGlx2TimeStamp checksumcTޛ1/L0 1240737977end cREVGeneral breakpoints Overview @R cREVGeneral How to use @RSyntax @RiXcGlx2TimeStamp checksum cREVGeneral revUniqueID 1076374014340Tabs}3on menuPick pCard go to card pCard end menuPick @0Overview How to use SyntaxcGlx2TimeStamp checksum cREVGeometry Master,expectedRect 10,8,470,420Master,scalebottomDistance-10Master,movevDistancefalseMaster,scaleBottomObjectSideBottomMaster,movehDistancefalseMastertrueMaster,scalerightDistanceMaster,scaleBottomObjectRefcardMaster,scaleBottomAbsolutetrueMaster,cardRanking1Master,scaleBottomtrueMaster,scaleleftDistanceMaster,scaletopDistance cREVGeneral revUniqueID 1076048933875 Docs x7on linkClicked pLink revGoURL pLink end linkClicked @0ncGlx2TimeStamp checksum cREVTable currentview=

Sarah's SMTP library:

This library contains a set of commands for connecting to an SMTP mail server and sending emails, with Revolution. It offers the following options:

connect to a server returning the connection status

authenticating if required

format the email into the correct state for sending

adding header

encoding any attachments

send the email after having formatted it

disconnect from server

cancel current connection and stop any downloads

There are also various logging options which are set by sending a command to the library telling it which fields to use for log reports and how detailed you want the reports to be:

status single line report

transcript verbose or plain

gives a detailed indicator of the server

messages.

In this example stack, a single email can be constructed and sent, with or without attachments.

This library is provided "as is" for use or as a basis for further development. You are free to use it in any way you see fit, but no responsibility will be taken for any errors or problems that might lead to lost emails or any other inconvenience.

If you find it useful, please consider making a donation to my PayPal account using the link at http://www.troz.net/Rev where you will find many other useful stacks and scripting examples.

Version 1.2, Sarah Reichelt, April 2009

 cREVGeometry Master,expectedRect 20,48,460,408Master,scalebottomDistance-22Master,movevDistancefalseMaster,scaleBottomObjectSideBottomMaster,movehDistancefalseMastertrueMaster,scalerightDistanceMaster,scaleBottomObjectRefcardMaster,scaleBottomAbsolutetrueMaster,cardRanking1Master,scaleBottomtrueMaster,scaleleftDistanceMaster,scaletopDistance cREVGeneral revUniqueID 1076048933876  Sarah's SMTP library:  This library contains a set of commands for connecting to an SMTP mail server and sending emails, with Revolution. It offers the following options:  4connect to a server returning the connection status  authenticating if required 4format the email into the correct state for sending  adding header  encoding any attachments )send the email after having formatted it disconnect from server 1cancel current connection and stop any downloads There are also various logging options which are set by sending a command to the library telling it which fields to use for log reports and how detailed you want the reports to be:  status single line report  transcript verbose or plain + gives a detailed indicator of the server messages. `In this example stack, a single email can be constructed and sent, with or without attachments. This library is provided "as is" for use or as a basis for further development. You are free to use it in any way you see fit, but no responsibility will be taken for any errors or problems that might lead to lost emails or any other inconvenience. If you find it useful, please consider making a donation to my PayPal account using the link at http://www.troz.net/rev/ where you will find many other useful stacks and scripting examples. ` ` xE (Version 1.2, Sarah Reichelt, April 2009  #sSMTPlibrary commands & functions: " BsSMTPconnectToServer pServer, pCallBack [,pUseAuth, pUser, pPass] A . makes the connection and logs in if required < pServer address of SMTP server (with optional port number) A pCallBack handler in the object that calls sSMTPconnectToServer , , ; it gets a single parameter - the state of the connection 0 0  "OK" or an error message. - pUseAuth true or false - use authentication + pUser optional - authentication user name * pPass optional - authentication password sPOPcancelConnection  5 use to abort the email sending or server connection 1 it won't stop in the middle of sending an email IsSMTPbuildEmailText(pSender, pRecip, pSubject, pBody, pAttach, pUseHTML) H 8 this function formats the email text ready for sending > it adds all the required headers and encodes any attachments ! pSender email address of sender 5 pRecip email addresses of recipients (one per line)  pSubject subject of email % pBody text of email (HTML or plain) 4 pAttach list of files for attaching (one per line) F pUseHTML if true the text of email can contain either formatted text ' as set using the standard Text menu,  or actual HTML code. 8 (Note: the format of the text field will not be sent, & you must format the text directly.) >sSMTPsendMessage pSender, pRecip, pSubject, pBody, pCallback, = pAttach   sends the email to the server ! pSender email address of sender 5 pRecip email addresses of recipients (one per line)  pSubject subject of email ( pBody text of email as returned by the  sSMTPbuildEmailText function = pCallBack handler in the object that calls sSMTPsendMessage , , ; it gets a single parameter - the state of the sent email 5 5 ( "OK" or an error message if not sent. )sSMTPsetTranscriptField pField [, pType] ( E this function sets which field (if any) shows the server transcript # pField the long name of the field * pType verbose or plain (default = plain) sSMTPsetStatusField pField  B this function sets which field (if any) shows the current status # pField the long name of the field 6There are other handlers but these are called by the 7public handlers above and should not be used directly.  )1. Start using the "sSMTPlibrary" stack -2. Set up the parameters for the connection:  SMTP server , User name (if authentication is required) + Password (if authentication is required) 53. Write your email, entering the following details:  Recipients (one per line) Sender Subject Email text Note: To send html formatted text, check the 'Send html email' button and format the text in the email either using the Text menu or by entering raw html. Formatting the field itself will do nothing. If using raw HTML, the text must start with . 94. Select files to attach, using the "+" or "-" buttons. 4 This requires a complete file path (one per line) ?5. Construct a callback handler that will accept the result of 9 the connection attempt - either OK or an error message. = This must be in the same script as the handler that calls % the "sSMPTconnectToServer" command. F6. Construct a second callback handler that will accept the result of 6 the sending attempt - either OK or an error message. = This must be in the same script as the handler that calls ! the "sSMPTsendMessage" command. F7. Use the "sSMTPsetTranscriptField" command if you want a transcript * This requires the LONG name of the field E8. Use the "sSMTPsetStatusField" command if you want a status report * This requires the LONG name of the field A9. Send the "sSMTPconnectToServer" command, with the parameters: # SMTP server (name or IP address)  callback handler name  User name (if required) ) Password - in plain text (if required) K10. If the library connects to the server, it will send OK to the callback 9 handler. Otherwise, it will send an error message back. *11. The callback needs to send the email. D In the example, only one is sent, but this can be set up as a loop & to proces a list of outgoing emails. D12. If the email is sent correctly, it will send OK to the callback 9 handler. Otherwise, it will send an error message back. 13. Disconnect from the server. mThe example stack contains all this in the "Send email" button, so check it's script for a detailed example. `1