#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" " altEmailHarness 3 on stripAndShip put "" into fld "server" put "" into fld "username" put "" into fld "password" put "" into fld "from" put "" into fld "senderName" put "" into fld "to" put "" into fld "cc" put "" into fld "bcc" put "" into fld "replyToEmail" put "" into fld "subject" put "" into fld "messageText" put "" into fld "altLog" hilite btn "Use Authentication" end stripAndShip on doIt end doIt } Test harness for libSmtp253 U Tahoma U Tahoma W Tahoma U Tahoma U Tahoma W tahoma W Tahoma W Tahoma U Courier New W tahoma U tahoma W Tahoma U Tahoma U Tahoma U tahoma cREVGeneral scriptChecksum das@]D% debugObjects bookmarks handlerList stripAndShip doIttempScript prevHandler stripAndShipscriptSelection char 410 to 409script
on stripAndShip
put "" into fld "server"
put "" into fld "username"
put "" into fld "password"
put "" into fld "from"
put "" into fld "senderName"
put "" into fld "to"
put "" into fld "cc"
put "" into fld "bcc"
put "" into fld "replyToEmail"
put "" into fld "subject"
put "" into fld "messageText"
put "" into fld "altLog"
hilite btn "Use Authentication"
end stripAndShip
on doIt
end doIt
cREVGeometryCache stackID 1058 @ cREVGeneral bookmarks handlerList tempScript prevHandler scriptSelection char 1 to 0script cREVGeometryCacheIDs "1130963158514 10151130968748574 10411130968748575 10421130963158515 10161131143106362 10511130967972136 10381130967972137 10391131141738559 10501130967967577 10351130972182028 10481130967967578 10361130963165343 10171130963165344 10181130964092070 10271130964092071 10281130963110561 10111130963110562 10121131143142757 10521130963068959 10061130963199676 10211130970834442 10431130967838441 10301130967838442 10311130963066320 10041130963102080 10091130967871816 10331131143142769 10531130963102081 10101130963096600 10071130963096601 10081130967934594 10341130971727467 10461130963209702 10241130963203487 1022 cREVGeometrycache total 34order Label Field " [ d cREVTable currentview Server* cREVGeneral revUniqueID 1130963066320 Server* Label Field " y d cREVTable currentview Username cREVGeneral revUniqueID 1130963096600 Username Label Field " d cREVTable currentview Password cREVGeneral revUniqueID 1130963102080 Password Label Field U 1 cREVTable currentview To* cREVGeneral revUniqueID 1130963110561 To* Label Field " d cREVTable currentview Subject cREVGeneral revUniqueID 1130963158514 Subject Label Field " d cREVTable currentview Message Text cREVGeneral revUniqueID 1130963165343 Message Text Send Email Epvon mouseUp --> INIT VARS put fld "server" into tServer put fld "username" into tUsername put fld "password" into tPassword put fld "from" into tFrom put fld "senderName" into tSenderName put fld "to" into tTo put fld "cc" into tCC put fld "bcc" into tBCC put fld "replyToEmail" into tReplyToEmail put fld "subject" into tSubject put fld "messageText" into tMsg if the hilite of btn "use Authentication" is true then put "AUTO" into tAuthentication else put "" into tAuthentication end if put 25 into tPort get altSendEmail(tServer,tUsername,tPassword,tAuthentication,tPort,tFrom,tSenderName,tTo,tCC,tBCC,tReplyToEmail,tSubject,tMsg) if it is "false" then answer information "Send Failed" end mouseUp --> BEGIN altSendMail SCRIPTS --> COPY ALL FUNCTIONS AND HANDLERS BELOW ------------------------------------------ function altSendEmail pServer,pUsername,pPassword,pAuthentication,pPort,pFrom,pSenderName,pTo,pCC,pBCC,pReplyToEmail,pSubject,pMsg --> SENDS PLAIN TEXT EMAIL WHERE: --> pServer IS DOMAIN OR IPADDRESS OF SMTP SERVER (ex. mail.ibm.com) --> pUsername IS THE USERNAME FOR THE USER ON THAT SERVER --> pPassword IS THE PASSWORD FOR THE USER ON THAT SERVER --> pAuthentication IS THE AUTHENTICATION TYPE: AUTO,PLAIN,LOGIN or "" FOR NO AUTHENTICATION --> pPort IS THE PORT NUMBER (USUALLY 25) --> pFrom IS THE EMAIL ADDRESS OF THE USER SENDING THE EMAIL *NOTE* FOR MOST SMTP SERVERS IT MUST BE A VALID EMAIL ADDRESS! --> pSenderName IS THE NAME OF THE USER SENDING THE EMAIL --> pTo IS A LINEFEED DELIMITED LIST OF 'TO' RECIPIENTS --> pCC IS A LINEFEED DELIMITED LIST OF 'CC' RECIPIENTS --> pBCC IS A LINEFEED DELIMITED LIST OF 'BCC' RECIPIENTS --> pReplyToEmail IS THE EMAIL ADDRESS WHICH ALL REPLIES ARE SENT TO --> pSubject IS THE SUBJECT OF THE EMAIL --> pMsg IS THE TEXT OF THE MESSAGE TO BE SENT if "libSmtp253" is not among the lines of the stacksInUse then start using stack "libSmtp253" end if if pPort is "" then put 25 into pPort altLog "" --> BUILD HEADERS AND RECIPIENT LIST put "" into tHeader put "from: " & line 1 of pSenderName && "<" & line 1 of pFrom & ">" & cr after tHeader put "subject: " & line 1 of pSubject & cr after tHeader put "sender: " & line 1 of pSenderName & cr after tHeader put "reply-to: " & line 1 of pReplyToEmail & cr after tHeader --> THIS CONSTRUCTS THE LIST OF EMAIL RECIPIENTS --> EVERYONE WILL SEE USERS IN LISTED IN tHeader --> tRecipientList IS LIST OF EVERYONE SENT AN EMAIL put "" into tRecipientList repeat for each line L in pTo if "@" is not in L then next repeat put "to: " & L & cr after tHeader put L & cr after tRecipientList end repeat repeat for each line M in pCC if "@" is not in M then next repeat put "cc: " & M & cr after tHeader put M & cr after tRecipientList end repeat repeat for each line N in pBCC if "@" is not in N then next repeat put N & cr after tRecipientList end repeat delete last char of tRecipientList --> OPEN CONNECTION TO SMTP SERVER get smtpOpen(pServer,pPort,pAuthentication,pUsername,pPassword) altLog "Opening:" & it if it is false then get smtpClose() altLog "Error Connecting to Server:" & it altLog smtpGetTranscript() return "false" end if put tHeader &cr& pMsg into tBody --> SEND EMAIL get smtpSend(pFrom,tRecipientList,tBody) altLog "Sending:" & it if it is "false" then put "false" into tReturn get smtpClose() altLog "Closing:" & it if it is "false" then put "false" into tReturn altLog smtpGetTranscript() stop using stack "libSmtp253" return tReturn end altSendEmail on altLog pMsg if there is not a fld "altLog" then exit altLog if pMsg is "" then put "" into fld "altLog" else put pMsg & cr after fld "altlog" set the vscroll of fld "altlog" to 10000000 end if end altLog 1z R cREVGeneral scriptChecksum CBOzWY7TbreakPoints handlerList mouseUp altSendEmail altLogscriptSelection char 2013 to 2012revUniqueID 1130963199676 bookmarks tempScript prevHandler mouseUpscripton mouseUp
--> INIT VARS
put fld "server" into tServer
put fld "username" into tUsername
put fld "password" into tPassword
put fld "from" into tFrom
put fld "senderName" into tSenderName
put fld "to" into tTo
put fld "cc" into tCC
put fld "bcc" into tBCC
put fld "replyToEmail" into tReplyToEmail
put fld "subject" into tSubject
put fld "messageText" into tMsg
if the hilite of btn "use Authentication" is true then
put "AUTO" into tAuthentication
else
put "" into tAuthentication
end if
put 25 into tPort
get altSendEmail(tServer,tUsername,tPassword,tAuthentication,tPort,tFrom,tSenderName,tTo,tCC,tBCC,tReplyToEmail,tSubject,tMsg)
if it is "false" then answer information "Send Failed"
end mouseUp
--> BEGIN altSendMail SCRIPTS
--> COPY ALL FUNCTIONS AND HANDLERS BELOW
------------------------------------------
function altSendEmail pServer,pUsername,pPassword,pAuthentication,pPort,pFrom,pSenderName,pTo,pCC,pBCC,pReplyToEmail,pSubject,pMsg
--> SENDS PLAIN TEXT EMAIL WHERE:
--> pServer IS DOMAIN OR IPADDRESS OF SMTP SERVER (ex. mail.ibm.com)
--> pUsername IS THE USERNAME FOR THE USER ON THAT SERVER
--> pPassword IS THE PASSWORD FOR THE USER ON THAT SERVER
--> pAuthentication IS THE AUTHENTICATION TYPE: AUTO,PLAIN,LOGIN or "" FOR NO AUTHENTICATION
--> pPort IS THE PORT NUMBER (USUALLY 25)
--> pFrom IS THE EMAIL ADDRESS OF THE USER SENDING THE EMAIL *NOTE* FOR MOST SMTP SERVERS IT MUST BE A VALID EMAIL ADDRESS!
--> pSenderName IS THE NAME OF THE USER SENDING THE EMAIL
--> pTo IS A LINEFEED DELIMITED LIST OF 'TO' RECIPIENTS
--> pCC IS A LINEFEED DELIMITED LIST OF 'CC' RECIPIENTS
--> pBCC IS A LINEFEED DELIMITED LIST OF 'BCC' RECIPIENTS
--> pReplyToEmail IS THE EMAIL ADDRESS WHICH ALL REPLIES ARE SENT TO
--> pSubject IS THE SUBJECT OF THE EMAIL
--> pMsg IS THE TEXT OF THE MESSAGE TO BE SENT
if "libSmtp253" is not among the lines of the stacksInUse then
start using stack "libSmtp253"
end if
if pPort is "" then put 25 into pPort
altLog ""
--> BUILD HEADERS AND RECIPIENT LIST
put "" into tHeader
put "from: " & line 1 of pSenderName && "<" & line 1 of pFrom & ">" & cr after tHeader
put "subject: " & line 1 of pSubject & cr after tHeader
put "sender: " & line 1 of pSenderName & cr after tHeader
put "reply-to: " & line 1 of pReplyToEmail & cr after tHeader
--> THIS CONSTRUCTS THE LIST OF EMAIL RECIPIENTS
--> EVERYONE WILL SEE USERS IN LISTED IN tHeader
--> tRecipientList IS LIST OF EVERYONE SENT AN EMAIL
put "" into tRecipientList
repeat for each line L in pTo
if "@" is not in L then next repeat
put "to: " & L & cr after tHeader
put L & cr after tRecipientList
end repeat
repeat for each line M in pCC
if "@" is not in M then next repeat
put "cc: " & M & cr after tHeader
put M & cr after tRecipientList
end repeat
repeat for each line N in pBCC
if "@" is not in N then next repeat
put N & cr after tRecipientList
end repeat
delete last char of tRecipientList
--> OPEN CONNECTION TO SMTP SERVER
get smtpOpen(pServer,pPort,pAuthentication,pUsername,pPassword)
altLog "Opening:" & it
if it is false then
get smtpClose()
altLog "Error Connecting to Server:" & it
altLog smtpGetTranscript()
return "false"
end if
put tHeader &cr& pMsg into tBody
--> SEND EMAIL
get smtpSend(pFrom,tRecipientList,tBody)
altLog "Sending:" & it
if it is "false" then put "false" into tReturn
get smtpClose()
altLog "Closing:" & it
if it is "false" then put "false" into tReturn
altLog smtpGetTranscript()
stop using stack "libSmtp253"
return tReturn
end altSendEmail
on altLog pMsg
if there is not a fld "altLog" then exit altLog
if pMsg is "" then
put "" into fld "altLog"
else
put pMsg & cr after fld "altlog"
set the vscroll of fld "altlog" to 10000000
end if
end altLog
Label Field " d cREVTable currentview Log cREVGeneral revUniqueID 1130963209702 Log fro " d cREVTable currentview From Email* cREVGeneral revUniqueID 1130964092070 From Email* fro " d cREVTable currentview Sender's Name cREVGeneral revUniqueID 1130967838441 Sender's Name Label Field 7 cREVTable currentview Account Settings cREVGeneral revUniqueID 1130967871816 Account Settings Label Field cREVTable currentview Email Settings cREVGeneral revUniqueID 1130967934594 Email Settings CCd UH 1 cREVTable currentview CC cREVGeneral revUniqueID 1130967967577 CC BCCs Uz 1 cREVTable currentview BCC cREVGeneral revUniqueID 1130967972136 BCC Label Field " d cREVTable currentview Reply To Email cREVGeneral revUniqueID 1130968748574 Reply To Email description 7on linkClicked pLink revGoURL pLink end linkClicked 3 2 cREVGeneral revUniqueID 1130970834442 altEmailHarness .by Chipp Walters using Sean Shao's libSmtp253 - What does this do? 5Makes sending an email from your stack super simple. This is a simple test stack for Sean Shao's fine SMTP library used for sending emails directly from Revolution. This stack works with the included library stack libSmtp253. tIncluded in this stack is a simple altSendMail function, which is a basic wrapper around Sean's libSmtp253 library. # # . 2 ` j SSean's library stacks are great, and they offer so many options...in fact, too many options! You can send HTML as well as Plain text, connect to various servers with different authentication schemes, and more! The reason I wrote this stack is to build a very simple test harness which allow you to send PLAIN text email directly from Rev. How to use it? mYou'll need to have an existing SMTP server you want to use and fill out the Account Settings appropriately. M M ] zThen fill out your Email Settings and press the Send Email button. Below in the Log field you will see what is happening. ! 0 : ? iTo incorporate into your stack, just copy the altSendEmail and altLog functions from the Send Email button into your own button, and copy the substack libSmtp253 into your main stack. If you want to log and check activity, create a fld "altLog" on the same card where you are calling altSendEmail and all communication with the server will be displayed there. . . : ? E Y b 5 G ( ( @ fAll the documentation for the parameters of altSendEmail function are in the script. Hope this helps! , , 8 - 4Muchos Kudos to Sean Shao and the great libSmtp253! 3 Chipp Walters Altuit, inc Directions Ep Xon mouseUp get the htmlText of fld "description" answer information it end mouseUp 0 R cREVGeneral revUniqueID 1130971727467 Label Field B cREVTable currentview (* denotes fld which must have valid data cREVGeneral revUniqueID 1130972182028 )* denotes fld which must have valid data server i` [ cREVGeneral revUniqueID 1130963068959 username i` y cREVGeneral revUniqueID 1130963096601 password i` cREVGeneral revUniqueID 1130963102081 from i` cREVTable currentview chipp@chipp.com cREVGeneral revUniqueID 1130964092071 senderName i` cREVTable currentview cREVGeneral revUniqueID 1130967838442 To )` 0 cREVGeneral revUniqueID 1130963110562 ` @ s . CC )` H 0 cREVGeneral revUniqueID 1130967967578 ` @ sI . bcc )` z 0 cREVGeneral revUniqueID 1130967972137 ` @ s{ . replytoemail i` cREVTable currentview test222 cREVGeneral revUniqueID 1130968748575 subject i` cREVGeneral revUniqueID 1130963158515 messageText )` h cREVGeneral revUniqueID 1130963165344 ` @ s f altLog )` > cREVGeneral revUniqueID 1130963203487 ` @ s <