Thursday, December 8, 2011

[[ rem ********************* GENERAL ADMIN ********************* ]]

[[ rem ========== SET THE LOG ========== ]]

[[ log("begin test log"+CR) ]]
[[ log(" "+CR+" "+CR) ]]

[[ log("Begin General Admin"+CR) ]]
[[ log(" "+CR+" "+CR) ]]

[[ rem ---------- end of set the log ---------- ]]



[[ var HeaderSubjectMain = "WHO KNOWS WHAT THIS IS FOR" ]]

[[ var HeaderSubject = "BBBBB" ]]

[[ var HeaderSenderAddress = "CCCCC" ]]
[[ var HeaderFromAddress = "DDDDD" ]]
[[ var HeaderReplyToAddress = "EEEEE" ]]
[[ var ResponseFileName = "Bounce.txt" ]]
[[ var DisplayBounceCount = 0 ]]








[[ rem ========== SET GLOBAL "CONSTANTS" ========== ]]

[[ var CRC = 0 ]]

[[ rem ---------- end of set global "constants" ---------- ]]



[[ rem ========== SET VARIABLES FOR THIS CYCLE ========== ]]

[[ rem Generate the Random String for the Confirmation Code ]]

[[ var RandomString = convert_to_string(random(1234567890, 9876543210)) ]]

[[ var RandomString = "1234567123" ]]


[[ rem ---------- end of set variables for this cycle ---------- ]]




[[ rem ========== SET EZINE SPECIFIC VARIABLES ========== ]]

[[ gmerge(file_fetch(ScriptFileBaseEzine + "Set Info.txt")) ]]

[[ rem ---------- end of set ezine specific variables ---------- ]]




[[ rem ========== SET VARIABLES THAT DON'T CHANGE ========== ]]

[[ var IncomingAddressee = incoming_get_header("To") ]]
[[ var IncomingAddresseeLC = convert_lower_case(IncomingAddressee) ]]

[[ var IncomingAddresseeStripped = str_replace_i(IncomingAddressee, "<", "~") ]] [[ var IncomingAddresseeStripped = str_replace_i(IncomingAddresseeStripped, ">", "~") ]]
[[ var IncomingAddresseeStripped = str_replace_i(IncomingAddresseeStripped, "@", "(at)") ]]

[[ var AddressToForwardMe = EzineNameShort + " FORWARD (was " + IncomingAddresseeStripped + ") <" + EzinePersonalSendAddress + ">" ]]

[[ var EmailDateStr = incoming_get_header("Date") ]]

[[ var EmailDateDT = convert_to_date(EmailDateStr) ]]

[[ log("EmailDateStr: "+EmailDateStr+CR) ]]
[[ log("EmailDateDT: "+EmailDateDT+CR) ]]

[[ rem Remove quotation marks from -Recipient- ]]
[[ var RecipientMod = str_replace(-Recipient-, """", "") ]]

[[ var EmailLC = (convert_lower_case(-Email-)) ]]

[[ var IPAddress = incoming_get_ip() ]]

[[ rem Create a lower case subject string with no spaces to use to check for confirmation codes ]]

[[ var SubjectPackedLC = -Subject- ]]

[[ var Loc=str_find (SubjectPackedLC, " ", 0) ]]

[[ while Loc > -1 ]]

[[ log("removing spaces from the Packed Subject"+CR) ]]

[[ var Length = str_length(SubjectPackedLC) ]]
[[ var SubjectPackedLC = str_substring(SubjectPackedLC, 0, Loc) + str_substring(SubjectPackedLC, Loc+1, Length-Loc-1) ]]

[[ log("SubjectPackedLC: "+SubjectPackedLC+"!!!"+CR) ]]

[[ var Loc=str_find (SubjectPackedLC, " ", 0) ]]

[[ endw ]]

[[ var SubjectPackedLC = convert_lower_case(SubjectPackedLC) ]]

[[ var ModSubject1 = -Subject- ]]
[[ var ModSubject2 = "" ]]

[[ var LengthModSubject1 = str_length(ModSubject1) ]]

[[ log("LengthModSubject1: "+LengthModSubject1+CR) ]]

[[ if LengthModSubject1 > 50 ]]

[[ log("split the subject"+CR) ]]

[[ var CharPos1 = 49 ]]
[[ while str_substring(ModSubject1, CharPos1, 1) != " " ]]
[[ var CharPos1 = CharPos1 - 1 ]]
[[ endw ]]

[[ log("CharPos1: "+number_format(CharPos1)+CR) ]]

[[ var CharPos2 = CharPos1 ]]
[[ while str_substring(ModSubject1, CharPos2, 1) = " " ]]
[[ var CharPos2 = CharPos2 + 1 ]]
[[ endw ]]

[[ log("CharPos2: "+number_format(CharPos2)+CR) ]]

[[ var ModSubject2 = str_substring(ModSubject1, CharPos2, LengthModSubject1 - CharPos2) ]]
[[ var ModSubject1 = str_substring(ModSubject1, 0, CharPos1) ]]

[[ log("ModSubject1: "+ModSubject1+CR) ]]
[[ log("ModSubject2: "+ModSubject2+CR) ]]
[[ endif ]]

[[ rem ---------- end of set variables that don't change ---------- ]]



[[ rem ========== INITIALIZE VARIABLES ========== ]]

[[ rem ++++++++++++++++++++++++++++++ ]]

[[ var ConfirmationNumber = "" ]]
[[ var ConfirmationCode = "" ]]
[[ var SimpleEmailAddress = "" ]]


[[ var ConfirmDoubleResponse = FALSE ]]

[[ var GoodConfirmFormat = FALSE ]]

[[ var ContinueCheckingEmail = TRUE ]]

[[ var BounceEmail = FALSE ]]

[[ var SubscribeInAddress = FALSE ]]
[[ var SubscribeInSubject = FALSE ]]
[[ var SubscribeRequest = FALSE ]]
[[ var SubscribeRequestFromWebForm = FALSE ]]

[[ var UnsubscribeInAddress = FALSE ]]
[[ var UnsubscribeInSubject = FALSE ]]
[[ var UnsubscribeRequest = FALSE ]]
[[ var UnsubscribeRequestFromWebForm = FALSE ]]

[[ var ConfirmInSubject = FALSE ]]
[[ var ConfirmInBody = FALSE ]]
[[ var ConfirmRequest = FALSE ]]

[[ var SpamTestInAddress = FALSE ]]
[[ var SpamTestRequest = FALSE ]]

[[ var WhitelistInfoInAddress = FALSE ]]
[[ var WhitelistInfoRequest = FALSE ]]

[[ var MailwasherInAddress = FALSE ]]
[[ var MailwasherRequest = FALSE ]]

[[ var UnconfirmRequest = FALSE ]]

[[ var UnknownRequest = FALSE ]]

[[ var UseCommonEndProcess = FALSE ]]

[[ var GoodSubscriptionRequest = FALSE ]]
[[ var GoodSubscriptionConfirmRequest = FALSE ]]

[[ var ConfirmationCodeFromSubject = "" ]]
[[ var ConfirmationCodeFromBody = "" ]]

[[ var EmailVia = "Email" ]]
[[ var EmailDateTag = "Email Time" ]]

[[ var Message1 = "" ]]
[[ var Message2 = "" ]]
[[ var Message3 = "" ]]
[[ var Message4 = "" ]]

[[ log("After Initialize Variables"+CR) ]]


[[ rem ---------- end of initialize variables ---------- ]]




[[ rem ========== IF FORWARDING IS INDICATED, FORWARD TO ME ========== ]]

[[ log("Forward Check"+CR) ]]

[[ if ForwardToMe ]]
[[ log("Doing Forward"+CR) ]]
[[ var ForwardSuccess = incoming_forward(AddressToForwardMe) ]]
[[ endif ]]




[[ rem ========== CHECK FOR BOUNCE ========== ]]

[[ If ContinueCheckingEmail ]]

[[ rem Determine if a Bounce ]]

[[ log("Checking for Bounce"+CR) ]]

[[ var BounceEmail = incoming_is_bounce() ]]

[[ if BounceEmail ]]

[[ log("Found a Bounce"+CR) ]]

[[ var ContinueCheckingEmail = FALSE ]]

[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for bounce ---------- ]]




[[ rem ========== CHECK FOR RESTRICTED EMAIL ADDRESS ========== ]]

[[ If ContinueCheckingEmail ]]

[[ rem Determine if a Restricted Email Address ]]
[[ rem A Restricted Email Address is one of: ]]
[[ rem Subscribe Address ]]
[[ rem Unsubscribe Address ]]
[[ rem Admin Address ]]
[[ rem Delivery Address ]]
[[ rem Spam Test Address ]]
[[ rem Whitelist Information Address ]]
[[ rem Mailwasher Info Address ]]

[[ if str_contains_i(EmailLC, EzineSubscribeAddress) or
str_contains_i(EmailLC, EzineUnsubscribeAddress) or
str_contains_i(EmailLC, EzineAdminAddress) or
str_contains_i(EmailLC, EzineDeliveryAddress) or
str_contains_i(EmailLC, EzineHelpAddress) or
str_contains_i(EmailLC, EzineSpamTestAddress) or
str_contains_i(EmailLC, EzineWhitelistInfoAddress) or
str_contains_i(EmailLC, EzineWhitelistInfoMailwasherAddress) or

str_contains_i(EmailLC, "mailer-daemon") ]]

[[ log("this is a Restricted Email Address"+CR) ]]

[[ var RestrictedEmailAddress = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]

[[ else ]]

[[ var RestrictedEmailAddress = FALSE ]]

[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for restricted email address ---------- ]]




[[ rem ========== CHECK FOR UNSUBSCRIBE REQUEST ========== ]]

[[ If ContinueCheckingEmail ]]

[[ rem Check Address for "-unsubscribe" ]]

[[ var UnsubscribeInAddress = str_contains_i(IncomingAddresseeLC, "-unsubscribe") ]]

[[ rem Check Subject for "unsubscribe" ]]

[[ var UnsubscribeInSubject = str_contains_i(SubjectPackedLC, "unsubscribe") ]]

[[ if UnsubscribeInAddress or UnsubscribeInSubject ]]
[[ var UnsubscribeRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]
[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for unsubscribe request ---------- ]]




[[ rem ========== CHECK FOR WEB FORM UNSUBSCRIBE REQUEST ========== ]]

[[ If ContinueCheckingEmail ]]

[[ rem Check a Subject that indicates it is a web form request to unsubscribe ]]

[[ var UnsubscribeRequestFromWebForm = str_contains_i(-Subject-, WebUnsubscribeSubject) ]]

[[ if UnsubscribeRequestFromWebForm ]]
[[ var UnsubscribeRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]
[[ var EmailVia = "Web Form" ]]
[[ var EmailDateTag = "Web Mail Time" ]]
[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for web form unsubscribe request ---------- ]]




[[ rem ========== CHECK FOR SUBSCRIBE REQUEST ========== ]]

[[ If ContinueCheckingEmail ]]

[[ rem Check Address for "-subscribe" ]]

[[ var SubscribeInAddress = str_contains_i(IncomingAddresseeLC, "-subscribe") ]]

[[ rem Check Subject for "subscribe" ]]

[[ var SubscribeInSubject = str_contains_i(SubjectPackedLC, "subscribe") ]]

[[ if SubscribeInAddress or SubscribeInSubject ]]
[[ var SubscribeRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]
[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for subscribe request ---------- ]]




[[ rem ========== CHECK FOR WEB FORM SUBSCRIBE REQUEST ========== ]]

[[ If ContinueCheckingEmail ]]

[[ rem Check subject for the WebSubscribeSubject ]]

[[ var SubscribeRequestFromWebForm = str_contains_i(-Subject-, WebSubscribeSubject) ]]

[[ if SubscribeRequestFromWebForm ]]
[[ var SubscribeRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]
[[ var EmailVia = "Web Form" ]]
[[ var EmailDateTag = "Web Mail Time" ]]
[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for web form subscribe request ---------- ]]




[[ rem ========== CHECK FOR SPAM TEST REQUEST ========== ]]


[[ If ContinueCheckingEmail ]]

[[ rem Check Address for "-spamtest" or "-spam-test" ]]

[[ var SpamTestInAddress1 = str_contains_i(IncomingAddresseeLC, "-spamtest") ]]
[[ var SpamTestInAddress2 = str_contains_i(IncomingAddresseeLC, "-spam-test") ]]
[[ var SpamTestInAddress = SpamTestInAddress1 or SpamTestInAddress2 ]]

[[ if SpamTestInAddress ]]
[[ var SpamTestRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]
[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for spam test request ---------- ]]




[[ rem ========== CHECK FOR WHITELIST INFO REQUEST ========== ]]

[[ If ContinueCheckingEmail ]]

[[ log("Checking Whitelist"+CR) ]]

[[ rem Check Address for "-whitelist" ]]

[[ var WhitelistInfoInAddress = str_contains_i(IncomingAddresseeLC, "-whitelist") ]]

[[ if WhitelistInfoInAddress ]]
[[ var WhitelistInfoRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]

[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for whitelist info request ---------- ]]




[[ rem ========== CHECK FOR MAILWASHER WHITELIST INFO REQUEST ========== ]]

[[ If ContinueCheckingEmail ]]

[[ log("Checking Mailwasher Whitelist"+CR) ]]

[[ rem Check Address for "-mailwasher" ]]

[[ var MailwasherInAddress = str_contains_i(IncomingAddresseeLC, "-mailwasher") ]]

[[ if MailwasherInAddress ]]
[[ var MailwasherRequest = TRUE ]]
[[ var WhitelistInfoRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]
[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for mailwasher whitelist info request ---------- ]]




[[ rem ========== CHECK FOR CONFIRM REQUEST (CONFIRM IN SUBJECT) ========== ]]

[[ If ContinueCheckingEmail ]]

[[ rem Check Subject for "[c-" ]]

[[ var ConfirmInSubject = str_contains_i(SubjectPackedLC, "[c-") ]]

[[ if ConfirmInSubject ]]
[[ var ConfirmRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]

[[ log("found confirm in subject"+CR) ]]

[[ var ConfirmationCodeFromBody = latch_i(-Body-, "SCC:") ]]

[[ var ConfirmationCodeFromBody = str_trim(ConfirmationCodeFromBody) ]]

[[ if ConfirmationCodeFromBody != "" ]]

[[ var ConfirmInBody = TRUE ]]

[[ log("found confirm in body ALSO"+CR) ]]
[[ log("ConfirmationCodeFromBody: "+ConfirmationCodeFromBody+CR) ]]

[[ else ]]

[[var ConfirmationCodeFromBody = "Confirmation Code Not Found in Body of Email" ]]

[[ endif ]]

[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for confirm request (confirm in subject) ---------- ]]




[[ rem ========== CHECK FOR EMBEDDED CONFIRM REQUEST (CONFIRM IN BODY) ========== ]]

[[ If ContinueCheckingEmail ]]

[[ log("Checking Embedded Confirm Request"+CR) ]]

[[ rem Check body for "SCC: " ]]

[[ var ConfirmationCodeFromSubject = "Confirmation Code Not Found in Subject" ]]

[[ var ConfirmationCodeFromBody = latch_i(-Body-, "SCC:") ]]

[[ var ConfirmationCodeFromBody = str_trim(ConfirmationCodeFromBody) ]]

[[ if ConfirmationCodeFromBody != "" ]]
[[ var ConfirmInBody = TRUE ]]
[[ var ConfirmRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]

[[ log("found confirm in body ONLY"+CR) ]]
[[ log("ConfirmationCodeFromBody: "+ConfirmationCodeFromBody+CR) ]]

[[ endif ]]

[[ endif ]]

[[ rem ---------- end of check for embedded confirm request (confirm in body) ---------- ]]




[[ rem ========== DESIGNATE AS UNKNOWN PROCESS ========== ]]

[[ If ContinueCheckingEmail ]]

[[ var UnknownRequest = TRUE ]]
[[ var ContinueCheckingEmail = FALSE ]]

[[ log("this is an UnknownRequest"+CR) ]]

[[ endif ]]

[[ rem ---------- end of designate as unknown process ---------- ]]




[[ rem ========== PREPROCESS WEB FORMS ========== ]]

[[ if SubscribeRequestFromWebForm or UnsubscribeRequestFromWebForm ]]

[[ rem Reset the "email variables" which Gammadyne "presets" ]]
[[ rem so they will appear that the email came "from" the sender ]]

[[ rem -Email- --- The Email address of the sender ]]

[[ let -Email- = latch_i(-Body-, "subscriberemail:") ]]

[[ rem EmailLC (the lower case version of -Email- ]]

[[ var EmailLC = (convert_lower_case(-Email-)) ]]

[[ rem -FullName- --- The Name of the sender ]]

[[ let -FullName- = latch_i(-Body-, "subscribername:") ]]

[[ rem -Recipient- --- Combined name and email address of sender ]]

[[ if -FullName- != NULL ]]
[[ let -Recipient- = -FullName- + " <" + -Email- + ">" ]]
[[ else ]]
[[ let -Recipient- = -Email- ]]
[[ endif ]]

[[ rem Remove any quotes from Recipient to create RecipientMod ]]

[[ var RecipientMod = str_replace(-Recipient-, """", "") ]]

[[ rem Extract the IP Address variable from the email ]]

[[ var IPAddress = latch_i(-Body-, "ipaddr:") ]]

[[ rem Extract first name and last name ]]

[[ let -FirstName- = extract_first_name(-FullName-) ]]

[[ if -FirstName- != -FullName- ]]
[[ let -LastName- = extract_last_name(-FullName-) ]]
[[ else ]]
[[ let -LastName- = "" ]]
[[ endif ]]

[[ endif ]]

[[ rem ---------- end of preprocess web forms ---------- ]]




[[ rem ========== GRAB FIRST, MIDDLE AND LAST NAME DATA ========== ]]

[[ var LastNameMod = -LastName- ]]

[[ if -FirstName- != NULL ]]
[[ var FirstNameMod = -FirstName- ]]
[[ else ]]
[[ var FirstNameMod = "" ]]
[[ endif ]]

[[ if -FirstName- = NULL and -LastName- = NULL and -FullName- != NULL ]]
[[ var FirstNameMod = -FullName- ]]
[[ endif ]]

[[ if -FirstName- != NULL and -LastName- != NULL]]

[[ rem Isolate the Middle Name manually ]]

[[ var MiddleNameExtracted = latch_until_i(-FullName- + "", -FirstName- + "", -LastName- + "") ]]

[[ else ]]

[[ var MiddleNameExtracted = "" ]]

[[ endif ]]

[[ rem ---------- end of grab first, middle and last name data ---------- ]]




[[ rem ========== CHECK FOR SPECIAL DOMAIN NAMES ========== ]]

[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzaol.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "aol.com" ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzatt.netzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "att.net" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzcomcast.netzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "comcast.net" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzearthlink.netzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "earthlink.net" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzgmail.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "gmail.com" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzhotmail.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "hotmail.com" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzmindspring.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "mindspring.com" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzmsn.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "msn.com" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzmyvzw.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "myvzw.com" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzsbcglobal.netzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "sbcglobal.net" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzsprintmail.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "sprintmail.com" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzyahoo.comzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "yahoo.com" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var TestDomain = str_contains_i(MiddleNameExtracted, "zzworldnet.att.netzz") ]]
[[ if TestDomain ]]
[[ var DomainNameLC = "worldnet.att.net" ]]
[[ endif ]]
[[ endif ]]

[[ if !TestDomain ]]
[[ var DomainNameLC = convert_lower_case(-Domain-) ]]
[[ endif ]]

[[ if DomainNameLC = "aol.com" or DomainNameLC = "hotmail.com" or DomainNameLC = "msn.com" or DomainNameLC = "yahoo.com" or DomainNameLC = "gmail.com" ]]
[[ var DomainNotice = TRUE ]]
[[ else ]]
[[ var DomainNotice = FALSE ]]
[[ endif ]]

[[ if DomainNameLC = "aol.com" ]]
[[ var DomainAOL = TRUE ]]
[[ else ]]
[[ var DomainAOL = FALSE ]]
[[ endif ]]

[[ rem ---------- end of check for special domain names ---------- ]]




[[ rem ========== PROCESS BOUNCE ========== ]]

[[ if BounceEmail ]]

[[ rem SEEMS to be a bounce email ]]
[[ rem Check to see if the sender is in the database ]]
[[ rem IF they ARE, treat it as "unprocessed" ]]
[[ rem IF they are NOT, treat it as a BOUNCE ]]

[[ if !db_acquire_row(EmailLC) ]]

[[ rem sender is NOT in the database; Email Address NOT found ]]
[[ rem Treat as a bounce ]]

[[ var AdminBounce = FALSE ]]
[[ var DeliveryBounce = FALSE ]]

[[ rem Determine the type of bounce (Delivery, Admin, Misc) by looking at the TO address ']]

[[ if str_contains_i(IncomingAddresseeLC, EzineDeliveryAddress) ]]
[[ log("Delivery Bounce: " + IncomingAddresseeLC+CR) ]]
[[ var DeliveryBounce = TRUE ]]

[[ elseif str_contains_i(IncomingAddresseeLC, EzineAdminAddress) ]]
[[ log("Admin Bounce: " + IncomingAddresseeLC+CR) ]]
[[ var AdminBounce = TRUE ]]

[[ elseif str_contains_i(IncomingAddresseeLC, EzineDeliveryAddress) ]]
[[ log("Delivery Bounce: " + IncomingAddresseeLC+CR) ]]
[[ var DeliveryBounce = TRUE ]]

[[ else ]]
[[ log("Misc Bounce: " + IncomingAddresseeLC+CR) ]]

[[ endif ]]

[[ var HeaderSubjectMain = EzineNameShort + " Bounce" ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain + " " + ConfirmationCode ]]

[[ var HeaderSenderAddress = EzineBounceProcessAddress ]]
[[ var HeaderFromAddress = EzineBounceProcessAddress ]]
[[ var HeaderReplyToAddress = EzineBounceProcessAddress ]]
[[ var ResponseFileName = "Bounce.txt" ]]
[[ var DisplayBounceCount = 0 ]]

[[ var BounceEmailAddress = incoming_get_bounce() ]]

[[ log("BounceEmailAddress: " + BounceEmailAddress+CR) ]]

[[ if db_acquire_row(convert_lower_case(BounceEmailAddress)) ]]

[[ log("FOUND the subscriber: " + BounceEmailAddress+CR) ]]

[[ var DisplayFullEmailAddress = FullEmailAddress ]]
[[ var DisplayBounceCount = BounceCount ]]

[[ if DeliveryBounce ]]

[[ rem This is a Delivery Bounce ]]
[[ var DisplayBounceCount = DisplayBounceCount + 1 ]]
[[ let BounceCount = DisplayBounceCount ]]
[[ if SubscriberStatus = TRUE ]]

[[ if BounceCount >= 5 ]]


[[ log("Unsubscribing on Bounce Count"+CR) ]]

[[ let SubscriberStatus = FALSE ]]
[[ let UnsubscribeReason = "Bounces" ]]
[[ let UnsubscribeDate = MyNow ]]
[[ let UnsubscribeSource = "Bounces" ]]
[[ let LastActionDate = MyNow ]]

[[ var Message1 = "Unsubscribed on bounces." ]]
[[ else ]]
[[ var Message1 = "Bounced. Remains subscribed." ]]
[[ endif ]]
[[ else ]]

[[ log("Already unsubscribed"+CR) ]]

[[ var Message1 = "Already unsubscribed." ]]
[[ endif ]]

[[ else ]]
[[ rem This is NOT a Delivery Bounce ]]

[[ if AdminBounce ]]
[[ var Message1 = "NOT a Delivery Bounce. This is an ADMIN Bounce." ]]
[[ elseif ]]
[[ var Message1 = "NOT a Delivery Bounce. This is an UNKNOWN Bounce." ]]
[[ endif ]]
[[ endif ]]

[[ else ]]

[[ var DisplayFullEmailAddress = -Email- ]]
[[ var Message1 = "Subscriber not found." ]]

[[ endif ]]

[[ var ResponseFileName = "Bounce.txt" ]]

[[ rem Adjust -Recipient- before responding ]]

[[ let -Recipient- = EzineBounceProcessAddress ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + ResponseFileName ]]

[[ log("Sending bounce notification"+CR) ]]

[[ incoming_autorespond() ]]

[[ else ]]

[[ rem YES, in the database; Treat as "unprocessed" ]]

[[ log("Sender found ... treat as unprocessed"+CR) ]]

[[ var BounceEmail = FALSE ]]
[[ var UnknownRequest = TRUE ]]
[[ var UseCommonEndProcess = TRUE ]]

[[ endif ]]

[[ endif ]]

[[ rem ---------- end of process bounce ---------- ]]




[[ rem ========== PROCESS SUBSCRIBE REQUEST ========== ]]

[[ if SubscribeRequest ]]

[[ log("Process Subscribe Request"+CR) ]]

[[ var Request = FALSE ]]

[[ rem Check to see if the person is in the database ]]

[[ if !db_acquire_row(EmailLC) ]]

[[ rem NOT in the database; Email Address NOT found ]]

[[ rem Add a basic record and Set for Confirmation ]]

[[ db_add_row() ]]

[[ var GoodSubscriptionRequest = TRUE ]]

[[ let SubscriberStatus = FALSE ]]
[[ let SentStatus = FALSE ]]

[[ rem FullEmailAddress will be replaced at the end of the processing ]]

[[ let FullEmailAddress = "TO BE REPLACED" ]]

[[ let SimpleEmailAddress = EmailLC ]]

[[ let OriginalSubscribeDate = EmailDateStr ]]
[[ let LastSubscribeDate = EmailDateStr ]]
[[ let SubscribeSource = EmailVia ]]
[[ let SubscribeEmail = RecipientMod ]]
[[ let SubscribeIPAddress = IPAddress ]]

[[ let SubscribeConfirmDate = "" ]]
[[ let SubscribeConfirmEmail = "" ]]
[[ let SubscribeConfirmIPAddress = "" ]]

[[ let UnsubscribeReason = "" ]]
[[ let UnsubscribeDate = "" ]]
[[ let UnsubscribeEmail = "" ]]
[[ let UnsubscribeIPAddress = "" ]]

[[ let UnsubscribeConfirmDate = "" ]]
[[ let UnsubscribeConfirmEmail = "" ]]
[[ let UnsubscribeConfirmIPAddress = "" ]]

[[ let ConfirmationAction = "" ]]
[[ let ConfirmationNumber = "" ]]
[[ let ConfirmationResendCount = 0 ]]
[[ let LastConfirmationResendDate = MyNow ]]

[[ let LastActionDate = MyNow ]]
[[ let LastAction = "Added Record" ]]

[[ let BounceCount = NULL ]]

[[ rem FirstName, MiddleName and LastName will be replaced later ]]

[[ let FirstName = "" ]]
[[ let MiddleName = "" ]]
[[ let LastName = "" ]]

[[ let Notes = "" ]]

[[ rem Set Response to reflect normal case ]]

[[ var HeaderSubjectMain = HeaderSubjectMainSubscribeNormal ]]
[[ var HeaderReplyToAddress = HeaderReplyToAddressSubscribeNormal ]]
[[ var ResponseFileName = ResponseFileNameSubscribeNormal ]]

[[ rem End of processing for a new subscriber ]]

[[ else ]]

[[ rem FOUND in the database; Email Address WAS found ]]

[[ rem Check whether curently a subscriber ]]

[[ if SubscriberStatus = FALSE ]]

[[ rem NOT a subscriber ]]

[[ rem Whether already pending or not, ]]
[[ rem will need to update the name and record ]]

[[ var GoodSubscriptionRequest = TRUE ]]

[[ rem Check whether already pending ]]

[[ if ConfirmationNumber != "" and ConfirmationNumber != NULL ]]

[[ rem Subscription is already pending ]]

[[ rem Set Response to reflect special case: Resetting ]]

[[ var HeaderSubjectMain = HeaderSubjectMainSubscribeReset ]]
[[ var HeaderReplyToAddress = HeaderReplyToAddressSubscribeReset ]]
[[ var ResponseFileName = ResponseFileNameSubscribeReset ]]

[[ let LastActionDate = MyNow ]]
[[ let LastAction = "Reset Subscription Pending" ]]

[[ else ]]

[[ rem Subscription is NOT already pending ]]

[[ rem Set Response to reflect normal case ]]

[[ var HeaderSubjectMain = HeaderSubjectMainSubscribeNormal ]]
[[ var HeaderReplyToAddress = HeaderReplyToAddressSubscribeNormal ]]
[[ var ResponseFileName = ResponseFileNameSubscribeNormal ]]

[[ let LastActionDate = MyNow ]]
[[ let LastAction = "Subscription Pending" ]]

[[ endif ]]

[[ rem End of processing: subscription request and not a subscriber ]]

[[ else ]]

[[ rem requester is ALREADY a subscriber ]]

[[ rem NOTE: do not update name ]]

[[ var DisplayConfirmationCode = " " ]]

[[ var HeaderSubjectMain = HeaderSubjectMainSubscribeKept ]]
[[ var HeaderReplyToAddress = HeaderReplyToAddressSubscribeKept ]]
[[ var ResponseFileName = ResponseFileNameSubscribeKept ]]

[[ endif ]]

[[ rem End of processing: subscription request and found in DB ]]

[[ endif ]]

[[ rem Grab all Prior values in case needed ]]
[[ rem adjust them as necessary ]]

[[ var PriorFullEmailAddress = FullEmailAddress ]]

[[ var PriorSubscribeSource = SubscribeSource ]]

[[ if PriorSubscribeSource = "Web Form" ]]
[[ var PriorLastSubscribeDateTag = "Web Mail Time" ]]
[[ else ]]
[[ var PriorLastSubscribeDateTag = "Email Time" ]]
[[ endif ]]

[[ var PriorLastSubscribeDate = LastSubscribeDate ]]

[[ if SubscribeEmail != "Not Recorded" ]]
[[ var PriorSubscribeEmail = SubscribeEmail ]]
[[ else ]]
[[ var PriorSubscribeEmail = FullEmailAddress ]]
[[ endif ]]

[[ var PriorSubscribeIPAddress = SubscribeIPAddress ]]

[[ var PriorLastActionDate = LastActionDate ]]

[[ var PriorSubscribeConfirmEmail = SubscribeConfirmEmail ]]
[[ var PriorSubscribeConfirmIPAddress = SubscribeConfirmIPAddress ]]

[[ var PriorSubscribeConfirmDate = SubscribeConfirmDate ]]



[[ rem Update only if a Good Subscription Request ]]

[[ if GoodSubscriptionRequest ]]

[[ let FullEmailAddress = RecipientMod ]]

[[ let ConfirmationAction = "S" ]]
[[ let ConfirmationNumber = RandomString ]]
[[ let ConfirmationResendCount = 0 ]]
[[ let LastConfirmationResendDate = MyNow ]]

[[ var ConfirmationCode = "[c-" + RandomString + "-" + EmailLC + "]" ]]
[[ var DisplayConfirmationCode = ConfirmationCode ]]

[[ var PriorSubscribeSource = SubscribeSource ]]
[[ let SubscribeSource = EmailVia ]]

[[ if PriorSubscribeSource = "Web Form" ]]
[[ var PriorLastSubscribeDateTag = "Web Mail Time" ]]
[[ else ]]
[[ var PriorLastSubscribeDateTag = "Email Time" ]]
[[ endif ]]

[[ Var PriorLastSubscribeDate = LastSubscribeDate ]]
[[ let LastSubscribeDate = EmailDateStr ]]

[[ var PriorSubscribeEmail = SubscribeEmail ]]
[[ let SubscribeEmail = RecipientMod ]]

[[ var PriorSubscribeIPAddress = SubscribeIPAddress ]]
[[ let SubscribeIPAddress = IPAddress ]]

[[ var PriorLastActionDate = LastActionDate ]]
[[ let LastActionDate = MyNow ]]

[[ if -FullName- != NULL ]]

[[ rem This is a good sub request ]]
[[ rem AND the "name" also has data ]]
[[ rem SO ... update last, first and middle names ]]

[[ let LastName = LastNameMod ]]
[[ let FirstName = FirstNameMod ]]
[[ let MiddleName = MiddleNameExtracted ]]

[[ let Notes = "A>" + -FullName- + "< L>" + -LastName- + "< F>" + -FirstName- + "< M>" + MiddleName + "<" ]] [[ endif ]] [[ endif ]] [[ var UseCommonEndProcess = TRUE ]] [[ endif ]] [[ log("After Process Subscribe Request"+CR) ]] [[ rem ---------- end of process subscribe request ---------- ]] [[ rem ========== PROCESS CONFIRM REQUEST ========== ]] [[ if ConfirmRequest ]] [[ log("Process Confirm Request"+CR) ]] [[ log("process confirm"+CR) ]] [[ var GoodConfirmFromSubject = FALSE ]] [[ var GoodConfirmFromBody = FALSE ]] [[ var GoodConfirmFormat = TRUE ]] [[ var GoodSubscriptionConfirmRequest = FALSE ]] [[ if ConfirmInSubject ]] [[ rem Extract confirmation from the Subject ]] [[ rem Find the start of the Confirmation String: "[c-" ]] [[ var ConfirmLoc = str_find(SubjectPackedLC, "[c-", 0) ]] [[ var ConfirmationCodeFromSubject = str_substring(SubjectPackedLC, ConfirmLoc, 999) ]] [[ var ConfirmationCodeFromSubject = str_trim(ConfirmationCodeFromSubject) ]] [[ var ConfirmationCodeFromBody = str_trim(ConfirmationCodeFromBody) ]] [[ rem Check the format of the Confirmation Code from the Subject ]] [[ rem Find the end of the Confirmation String: "]" ]] [[ var ConfirmationCodeStop = str_find(ConfirmationCodeFromSubject, "]", 0) ]] [[ rem Check the format of the confirmation string ]] [[ If str_substring(ConfirmationCodeFromSubject, 13, 1) != "-"or ConfirmationCodeStop = -1 ]] [[ log("bad confirm format for confirmation code from subject"+CR) ]] [[ else ]] [[ log("good confirm format for confirmation code from subject"+CR) ]] [[ var ConfirmationCodeIn = ConfirmationCodeFromSubject ]] [[ var ConfirmationCodeInSource = "Email Subject" ]] [[ var ConfirmStr = str_substring(ConfirmationCodeFromSubject, 3, 10) ]] [[ var RequestEmailLength = ConfirmationCodeStop - 14 ]] [[ var RequestEmail = str_substring(ConfirmationCodeFromSubject, 14, RequestEmailLength) ]] [[ var GoodConfirmFromSubject = TRUE ]] [[ log("ConfirmStr: "+ConfirmStr+CR) ]] [[ log("RequestEmailLength: "+RequestEmailLength+CR) ]] [[ log("RequestEmail: "+RequestEmail+CR) ]] [[ endif ]] [[ endif ]] [[ if !GoodConfirmFromSubject ]] [[ if ConfirmInBody ]] [[ rem Check the format of the Confirmation Code from the Body ]] [[ var ConfirmationCodeIn = ConfirmationCodeFromBody ]] [[ rem Find the end of the Confirmation String: "]" ]] [[ var ConfirmationCodeStop = str_find(ConfirmationCodeFromBody, "]", 0) ]] [[ rem Check the format of the confirmation string ]] [[ If str_substring(ConfirmationCodeFromBody, 13, 1) != "-" or ConfirmationCodeStop = -1 ]] [[ log("bad confirm format for confirmation code from body"+CR) ]] [[ else ]] [[ log("good confirm format for confirmation code from body"+CR) ]] [[ var ConfirmationCodeIn = ConfirmationCodeFromBody ]] [[ var ConfirmationCodeInSource = "Email Body" ]] [[ var ConfirmStr = str_substring(ConfirmationCodeFromBody, 3, 10) ]] [[ var RequestEmailLength = ConfirmationCodeStop - 14 ]] [[ var RequestEmail = str_substring(ConfirmationCodeFromBody, 14, RequestEmailLength) ]] [[ var GoodConfirmFromBody = TRUE ]] [[ log("ConfirmStr: "+ConfirmStr+CR) ]] [[ log("RequestEmailLength: "+RequestEmailLength+CR) ]] [[ log("RequestEmail: "+RequestEmail+CR) ]] [[ endif ]] [[ endif ]] [[ endif ]] [[ if !GoodConfirmFromSubject and !GoodConfirmFromBody ]] [[ log("Bad Format"+CR) ]] [[ rem The confirm string is not in the proper format. ]] [[ rem The second dash is not positioned properly. ]] [[ rem or no terminal "]" could be found. ]] [[ var GoodConfirmFormat = FALSE ]] [[ var ConfirmDBRecordFound = FALSE ]] [[ var DisplayRequestEmail = "*~* Unknown *~*" ]] [[ var ConfirmationCodeIn = "*~* Unknown *~*" ]] [[ var ConfirmationCodeInSource = "*~* Not Found *~*" ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmBadFormat ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmBadFormat ]] [[ var ResponseFileName = ResponseFileNameConfirmBadFormat ]] [[ var UseCommonEndProcess = TRUE ]] [[ endif ]] [[ endif ]] [[ rem Continue processing confirm request if the Confirmation String was ok ]] [[ if ConfirmRequest and GoodConfirmFormat ]] [[ log("continue confirm"+CR) ]] [[ var RequestEmailLC = convert_lower_case(RequestEmail) ]] [[ var DisplayRequestEmail = RequestEmail ]] [[ rem See if the email was sent by the same address as is being confirmed ]] [[ if EmailLC != RequestEmailLC ]] [[ var ConfirmDoubleResponse = TRUE ]] [[ endif ]] [[rem Check to see if the confirmation address is in the database ]] [[ log("check for confirm addr in the db"+CR) ]] [[ if !db_acquire_row(RequestEmailLC) ]] [[ rem Address is NOT in the database; address not found ]] [[ log("addr not found in the db"+CR) ]] [[ var ConfirmDBRecordFound = FALSE ]] [[ var PriorSubscribeSource = "N/A - Subscription Request Not Found" ]] [[ var PriorLastSubscribeDateTag = "Request Time" ]] [[ var PriorLastSubscribeDate = "N/A - Subscription Request Not Found" ]] [[ var PriorSubscribeIPAddress = "N/A - Subscription Request Not Found" ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmNotFound ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmNotFound2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmNotFound1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmNotFound ]] [[ else ]] [[ rem Confirm for address that WAS found ]] [[ log("addr WAS found in the db"+CR) ]] [[ var ConfirmDBRecordFound = TRUE ]] [[ rem Grab all Prior values in case needed ]] [[ rem adjust them as necessary ]] [[ var PriorFullEmailAddress = FullEmailAddress ]] [[ var PriorSubscribeSource = SubscribeSource ]] [[ if PriorSubscribeSource = "Web Form" ]] [[ var PriorLastSubscribeDateTag = "Web Mail Time" ]] [[ else ]] [[ var PriorLastSubscribeDateTag = "Email Time" ]] [[ endif ]] [[ var PriorLastSubscribeDate = LastSubscribeDate ]] [[ if SubscribeEmail != "Not Recorded" ]] [[ var PriorSubscribeEmail = SubscribeEmail ]] [[ else ]] [[ var PriorSubscribeEmail = FullEmailAddress ]] [[ endif ]] [[ var PriorSubscribeIPAddress = SubscribeIPAddress ]] [[ var PriorLastActionDate = LastActionDate ]] [[ var PriorSubscribeConfirmEmail = SubscribeConfirmEmail ]] [[ var PriorSubscribeConfirmIPAddress = SubscribeConfirmIPAddress ]] [[ var PriorSubscribeConfirmDate = SubscribeConfirmDate ]] [[ rem Process Confirm for Subscription ]] [[ if ConfirmationAction = "S" ]] [[ rem Confirm is for a subscription ]] [[ log("ConfirmationAction is S"+CR) ]] [[ log("ConfirmationNumber"+" " + ConfirmationNumber + CR) ]] [[ log("ConfirmStr"+" " + ConfirmStr + CR) ]] [[ if ConfirmationNumber != " " and ConfirmationNumber != "" and ConfirmationNumber != ConfirmStr ]] [[ rem Confirm is for a subscription but code doesn't match ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmSubMismatch ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmSubMismatch2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmSubMismatch1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmSubMismatch ]] [[ else ]] [[rem Confirm is for a subscription and code matches ]] [[ var GoodSubscriptionConfirmRequest = TRUE ]] [[ rem Activate subscription ]] [[ let SubscriberStatus = TRUE ]] [[ let SubscribeConfirmDate = EmailDateStr ]] [[ let SubscribeConfirmEmail = RecipientMod ]] [[ let SubscribeConfirmIPAddress = IPAddress ]] [[ let ConfirmationNumber = "" ]] [[ let ConfirmationAction = "" ]] [[ rem If this request is NOT a double response ]] [[ rem that is, if the confirmation sender matches the subscriber ]] [[ rem then update the name info ]] [[ if !ConfirmDoubleResponse ]] [[ let FullEmailAddress = RecipientMod ]] [[ let LastName = LastNameMod ]] [[ let FirstName = FirstNameMod ]] [[ let MiddleName = MiddleNameExtracted ]] [[ let Notes = "A>" + -FullName- + "< L>" + -LastName- + "< F>" + -FirstName- + "< M>" + MiddleName + "<" ]] [[ endif ]] [[ var PriorLastActionDate = LastActionDate ]] [[ let LastActionDate = MyNow ]] [[ let LastAction = "Confirmed Subscription" ]] [[ rem Response to reflect success status ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmSubSuccess ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmSubSuccess2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmSubSuccess1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmSubSuccess ]] [[ endif ]] [[ elseif ConfirmationAction = "F" ]] [[ log("ConfirmationAction is F"+CR) ]] [[ rem Confirm is for a Force Confirm ]] [[ if ConfirmationNumber != ConfirmStr ]] [[ rem Confirm is for a Force Confirm but code doesn't match ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmForceMismatch ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmForceMismatch2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmForceMismatch1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmForceMismatch ]] [[ else ]] [[rem Confirm is for a Force Confirm and code matches ]] [[ var GoodSubscriptionConfirmRequest = TRUE ]] [[ rem Activate subscription ]] [[ let SubscriberStatus = TRUE ]] [[ let SubscribeConfirmDate = EmailDateStr ]] [[ let SubscribeConfirmEmail = RecipientMod ]] [[ let SubscribeConfirmIPAddress = IPAddress ]] [[ let ConfirmationNumber = "" ]] [[ let ConfirmationAction = "" ]] [[ rem If this request is NOT a double response ]] [[ rem that is, if the confirmation sender matches the subscriber ]] [[ rem then update the name info ]] [[ if !ConfirmDoubleResponse ]] [[ let FullEmailAddress = RecipientMod ]] [[ let LastName = LastNameMod ]] [[ let FirstName = FirstNameMod ]] [[ let MiddleName = MiddleNameExtracted ]] [[ let Notes = "A>" + -FullName- + "< L>" + -LastName- + "< F>" + -FirstName- + "< M>" + MiddleName + "<" ]] [[ endif ]] [[ var PriorLastActionDate = LastActionDate ]] [[ let LastActionDate = MyNow ]] [[ let LastAction = "Confirmed Subscription" ]] [[ rem Response to reflect success status ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmForceSuccess ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmForceSuccess2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmForceSuccess1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmForceSuccess ]] [[ endif ]] [[ elseif ConfirmationAction = "U" ]] [[ log("ConfirmationAction is U"+CR) ]] [[ rem Confirm is for a web based unsubscription ]] [[ if ConfirmationNumber != ConfirmStr ]] [[ rem Confirm is for an unsubcription but code doesn't match ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmUnsubMismatch ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmUnsubMismatch2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmUnsubMismatch1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmUnsubMismatch ]] [[ else ]] [[rem Confirm is for an unsubscription and code matches ]] [[ rem Deactivate subscription ]] [[ let SubscriberStatus = FALSE ]] [[ let UnsubscribeReason = "Unsub Confirmed" ]] [[ let UnsubscribeConfirmDate = EmailDateStr ]] [[ let UnsubscribeSource = EmailVia ]] [[ let UnsubscribeConfirmEmail = RecipientMod ]] [[ let UnsubscribeConfirmIPAddress = IPAddress ]] [[ let ConfirmationNumber = "" ]] [[ let ConfirmationAction = "" ]] [[ let LastActionDate = MyNow ]] [[ let LastAction = "Confirmed Unsubscription" ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmUnsubSuccess ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmUnsubSuccess2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmUnsubSuccess1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmUnsubSuccess ]] [[ endif ]] [[ else ]] [[ log("ConfirmationAction is not S, F or U"+CR) ]] [[ rem Confirm is for someone without any pending action ]] [[ if SubscriberStatus = TRUE ]] [[ rem Confirm for existing subscriber ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmSubKept ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmSubKept2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmSubKept1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmSubKept ]] [[ else ]] [[ rem Confirm for former subscriber with no pending actions ]] [[ rem Even though found, report as not found ]] [[ var HeaderSubjectMain = HeaderSubjectMainConfirmNotFound ]] [[ if ConfirmDoubleResponse ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmNotFound2 ]] [[ else ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressConfirmNotFound1 ]] [[ endif ]] [[ var ResponseFileName = ResponseFileNameConfirmNotFound ]] [[ endif ]] [[ endif ]] [[ endif ]] [[ var UseCommonEndProcess = TRUE ]] [[ endif ]] [[ log("After Process Confirm Request"+CR) ]] [[ rem ---------- end of process confirm request ---------- ]] [[ rem ========== PROCESS UNSUBSCRIBE REQUEST ========== ]] [[ if UnsubscribeRequest ]] [[ log("Process Unsubscribe Request"+CR) ]] [[ var UnsubSuccessful = FALSE ]] [[ if !db_acquire_row(EmailLC) ]] [[ rem Record is NOT in the database ]] [[ var DisplayConfirmationCode = "N/A - No Subscription Was Found" ]] [[ var HeaderSubjectMain = HeaderSubjectMainUnsubNotSubbed ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressUnsubNotSubbed ]] [[ var ResponseFileName = ResponseFileNameUnsubNotSubbed ]] [[ else ]] [[ rem Record WAS found in the database ]] [[ rem Grab all Prior values in case needed ]] [[ rem adjust them as necessary ]] [[ var PriorFullEmailAddress = FullEmailAddress ]] [[ var PriorSubscribeSource = SubscribeSource ]] [[ if PriorSubscribeSource = "Web Form" ]] [[ var PriorLastSubscribeDateTag = "Web Mail Time" ]] [[ else ]] [[ var PriorLastSubscribeDateTag = "Email Time" ]] [[ endif ]] [[ var PriorLastSubscribeDate = LastSubscribeDate ]] [[ if SubscribeEmail != "Not Recorded" ]] [[ var PriorSubscribeEmail = SubscribeEmail ]] [[ else ]] [[ var PriorSubscribeEmail = FullEmailAddress ]] [[ endif ]] [[ var PriorSubscribeIPAddress = SubscribeIPAddress ]] [[ var PriorLastActionDate = LastActionDate ]] [[ var PriorSubscribeConfirmEmail = SubscribeConfirmEmail ]] [[ var PriorSubscribeConfirmIPAddress = SubscribeConfirmIPAddress ]] [[ var PriorSubscribeConfirmDate = SubscribeConfirmDate ]] [[ rem Check whether is a subscriber ]] [[ log("Unsubscribe - Found - Checking whether subscriber"+CR) ]] [[ if SubscriberStatus = FALSE ]] [[ log("Unsubscribe - Found - NOT a subscriber"+CR) ]] [[ rem NOT a subscriber ]] [[ if ConfirmationAction = "S" ]] [[ log("Unsubscribe - Found - NOT a subscriber - S"+CR) ]] [[ rem Unsubscription for a "pending" subscription ]] [[ var UnsubSuccessful = TRUE ]] [[ var PriorSubscribeConfirmEmail = "Subscription was never confirmed" ]] [[ var PriorSubscribeConfirmDate = "Subscription was never confirmed" ]] [[ var PriorSubscribeConfirmIPAddress = "Subscription was never confirmed" ]] [[ var PriorUnsubscribeSource = UnsubscribeSource ]] [[ let UnsubscribeSource = EmailVia ]] [[ if PriorUnsubscribeSource = "Web Form" ]] [[ var PriorUnsubscribeDateTag = "Web Mail Time" ]] [[ else ]] [[ var PriorUnsubscribeDateTag = "Email Time" ]] [[ endif ]] [[ var PriorUnsubscribeDate = UnsubscribeDate ]] [[ let UnsubscribeDate = EmailDateStr ]] [[ var PriorUnsubscribeEmail = UnsubscribeEmail ]] [[ let UnsubscribeEmail = RecipientMod ]] [[ var PriorUnsubscribeIPAddress = UnsubscribeIPAddress ]] [[ let UnsubscribeIPAddress = IPAddress ]] [[ var PriorLastActionDate = LastActionDate ]] [[ let LastActionDate = MyNow ]] [[ let LastAction = "Unsubscribed Pending" ]] [[ let SubscriberStatus = FALSE ]] [[ let ConfirmationAction = "" ]] [[ let ConfirmationNumber = "" ]] [[ let UnsubscribeReason = "Unsub (Cancel) Pending Subscription" ]] [[ let UnsubscribeConfirmDate = EmailDateStr ]] [[ let UnsubscribeConfirmEmail = RecipientMod ]] [[ let UnsubscribeConfirmIPAddress = IPAddress ]] [[ var DisplayConfirmationCode = "N/A - Subscription Was Pending and Never Confirmed" ]] [[ var HeaderSubjectMain = HeaderSubjectMainUnsubPending ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressUnsubPending ]] [[ var ResponseFileName = ResponseFileNameUnsubPending ]] [[ else ]] [[ log("Unsubscribe - Found - NOT a subscriber - Not-S"+CR) ]] [[ rem Unsubscription for a "non-subscription" ]] [[ var DisplayConfirmationCode = "N/A - No Subscription Was Found" ]] [[ var HeaderSubjectMain = HeaderSubjectMainUnsubNotSubbed ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressUnsubNotSubbed ]] [[ var ResponseFileName = ResponseFileNameUnsubNotSubbed ]] [[ endif ]] [[ else ]] [[ rem A Subscriber --- unsubscribe the subscription ]] [[ var UnsubSuccessful = TRUE ]] [[ var PriorUnsubscribeSource = UnsubscribeSource ]] [[ let UnsubscribeSource = EmailVia ]] [[ if PriorUnsubscribeSource = "Web Form" ]] [[ var PriorUnsubscribeDateTag = "Web Mail Time" ]] [[ else ]] [[ var PriorUnsubscribeDateTag = "Email Time" ]] [[ endif ]] [[ var PriorUnsubscribeDate = UnsubscribeDate ]] [[ let UnsubscribeDate = EmailDateStr ]] [[ var PriorUnsubscribeEmail = UnsubscribeEmail ]] [[ let UnsubscribeEmail = RecipientMod ]] [[ var PriorUnsubscribeIPAddress = UnsubscribeIPAddress ]] [[ let UnsubscribeIPAddress = IPAddress ]] [[ var PriorLastActionDate = LastActionDate ]] [[ let LastActionDate = MyNow ]] [[ let LastAction = "Unsubscribe" ]] [[ rem Handle web unsubscribe requests different to email ]] [[ rem Web unsubscribes require a confirmation ]] [[ rem Email unsubscribes are processed immediately ]] [[ if UnsubscribeRequestFromWebForm ]] [[ rem Unsubscription request from the web - requires confirmation ]] [[ let LastAction = "Unsubscribe from Web" ]] [[ rem Check if unsub is alreaday pending ]] [[ if ConfirmationNumber != "" and ConfirmationNumber != NULL ]] [[ rem Unsubscription request is already pending ]] [[ var HeaderSubjectMain = HeaderSubjectMainUnsubConfirmReset ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressUnsubConfirmReset ]] [[ var ResponseFileName = ResponseFileNameUnsubConfirmReset ]] [[ else ]] [[ rem Unsubscription request; not already pending ]] [[ var HeaderSubjectMain = HeaderSubjectMainUnsubConfirm ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressUnsubConfirm ]] [[ var ResponseFileName = ResponseFileNameUnsubConfirm ]] [[ endif ]] [[ let ConfirmationAction = "U" ]] [[ let ConfirmationNumber = RandomString ]] [[ let ConfirmationNumber = RandomString ]] [[ var ConfirmationCode = "[c-" + RandomString + "-" + EmailLC + "]" ]] [[ var DisplayConfirmationCode = ConfirmationCode ]] [[ else ]] [[ rem Unsubscription request from email - unsubscribe immediately ]] [[ let LastAction = "Unsubscribe from Email" ]] [[ let SubscriberStatus = FALSE ]] [[ let ConfirmationAction = "" ]] [[ let ConfirmationNumber = "" ]] [[ let UnsubscribeReason = "Unsub Immediate" ]] [[ let UnsubscribeConfirmDate = EmailDateStr ]] [[ let UnsubscribeConfirmEmail = RecipientMod ]] [[ let UnsubscribeConfirmIPAddress = IPAddress ]] [[ var DisplayConfirmationCode = "No code needed. Email unsubs are processed immediately." ]] [[ var HeaderSubjectMain = HeaderSubjectMainUnsubSuccess ]] [[ var HeaderReplyToAddress = HeaderReplyToAddressUnsubSuccess ]] [[ var ResponseFileName = ResponseFileNameUnsubSuccess ]] [[ endif ]] [[ endif ]] [[ endif ]] [[ var UseCommonEndProcess = TRUE ]] [[ endif ]] [[ log("After Process Unsubscribe Request"+CR) ]] [[ rem ---------- end of process unsubscribe request ---------- ]] [[ rem ========== PROCESS SPAM TEST ========== ]] [[ if SpamTestRequest and RecipientMod != "Diane Walls " ]]

[[ log("Process Spam"+CR) ]]

[[ log("Begin SPAMTEST"+CR) ]]

[[ var HeaderReplyToAddress = HeaderReplyToAddressSpamTest ]]


[[ var SpamTestEmailNumber = "1" ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + "Spam Test 1.txt" ]]

[[ var SpamTestSender = EzineAdminAddress ]]
[[ var SpamTestSenderPurpose = EzineAdminAddressPurpose ]]
[[ var HeaderSubjectMain = "Spam Test Email #" + SpamTestEmailNumber ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]
[[ var HeaderSenderAddress = EzineNameShort + " Spam Test " + SpamTestEmailNumber + " <" + SpamTestSender + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]


[[ var SpamTestEmailNumber = "2" ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + "Spam Test 234.txt" ]]

[[ var SpamTestSender = EzineAdminAddress ]]
[[ var SpamTestSenderPurpose = EzineAdminAddressPurpose ]]

[[ var HeaderSubjectMain = "Spam Test Email #" + SpamTestEmailNumber ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]
[[ var HeaderSenderAddress = EzineNameShort + " Spam Test " + SpamTestEmailNumber + " <" + SpamTestSender + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]


[[ var SpamTestEmailNumber = "3" ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + "Spam Test 234.txt" ]]

[[ var SpamTestSender = EzineDeliveryAddress ]]
[[ var SpamTestSenderPurpose = EzineDeliveryAddressPurpose ]]

[[ var HeaderSubjectMain = "Spam Test Email #" + SpamTestEmailNumber ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]
[[ var HeaderSenderAddress = EzineNameShort + " Spam Test " + SpamTestEmailNumber + " <" + SpamTestSender + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]


[[ var SpamTestEmailNumber = "4" ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + "Spam Test 234.txt" ]]

[[ var SpamTestSender = EzinePersonalSendAddress ]]
[[ var SpamTestSenderPurpose = EzinePersonalSendAddressPurpose ]]

[[ var HeaderSubjectMain = "Spam Test Email #" + SpamTestEmailNumber ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]
[[ var HeaderSenderAddress = EzineNameShort + " Spam Test " + SpamTestEmailNumber + " <" + SpamTestSender + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]


[[ var SpamTestEmailNumber = "5" ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + "Spam Test 5.txt" ]]

[[ var SpamTestSender = EzineAdminAddress ]]

[[ var HeaderSubjectMain = "Spam Test Email #" + SpamTestEmailNumber ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]
[[ var HeaderSenderAddress = EzineNameShort + " Spam Test " + SpamTestEmailNumber + " <" + SpamTestSender + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]


[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ endif ]]

[[ log("AFter Process Spam"+CR) ]]

[[ rem ---------- end of process spam test ---------- ]]




[[ rem ========== PROCESS UNKNOWN ========== ]]

[[ if UnknownRequest ]]

[[ log("Process Unknown Request"+CR) ]]

[[ rem Reply to the sender with the "Unprocessed" message ]]
[[ rem and copy me ]]

[[ log("Processing the UnknownRequest"+CR) ]]

[[ if str_contains_i(IncomingAddresseeLC, EzineAdminAddress) ]]
[[ var HeaderReplyToAddress = HeaderReplyToAddressAdminUnknown ]]
[[ var ResponseFileName = ResponseFileNameAdminUnknown ]]

[[ elseif str_contains_i(IncomingAddresseeLC, EzineDeliveryAddress) ]]
[[ var HeaderReplyToAddress = HeaderReplyToAddressDeliveryUnknown ]]
[[ var ResponseFileName = ResponseFileNameDeliveryUnknown ]]

[[ else ]]
[[ var HeaderReplyToAddress = HeaderReplyToAddressUnknownUnknown ]]
[[ var ResponseFileName = ResponseFileNameUnknownUnknown ]]

[[ endif ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + ResponseFileName ]]

[[ rem var HeaderSenderAddress = SenderAddressText + " <" + EzineAdminAddress + ">" ]]

[[ var HeaderSenderAddress = HeaderReplyToAddress ]]

[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ var HeaderSubjectMain = HeaderSubjectMainUnknownForward + " [*** " + -Subject- + " ***]" ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]

[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ rem end of UnknownRequest processing ]]

[[ endif ]]

[[ log("After Unknown Request"+CR) ]]

[[ rem ---------- end of process unknown ---------- ]]




[[ rem ========== COMMON END PROCESS ========== ]]

[[ if UseCommonEndProcess ]]

[[ log("Begin Common End Process"+CR) ]]

[[ rem Append the main subject with the confirmation code ]]

[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain + " " + ConfirmationCode ]]

[[ rem Expand the Response File Name by prepending the base path ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + ResponseFileName ]]

[[ rem Use the RecipientMod to send the email ]]

[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ rem If this is a confirm request from a second email address, ]]
[[ rem send the second email ]]

[[ if ConfirmDoubleResponse ]]

[[ rem Where to send it to depends . . . ]]
[[ rem on whether the record was found in the DB ]]

[[ if ConfirmDBRecordFound ]]

[[ rem Record found: use the data from the record ]]

[[ let -Recipient- = FullEmailAddress ]]

[[ else ]]

[[ rem Record NOT found: use the data from the confirmation request record ]]

[[ let -Recipient- = RequestEmail ]]

[[ endif ]]

[[ rem Send the second email ]]

[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ endif ]]

[[ endif ]]

[[ rem ---------- end of common end process ---------- ]]




[[ rem ========== PROCESS WHITELIST INFO REQUEST ========== ]]

[[ rem NB: Good Subscription Requests and Good Subscription Confirmation Requests ]]
[[ rem are also processed by this section ]]


[[ if WhitelistInfoRequest or GoodSubscriptionRequest or GoodSubscriptionConfirmRequest ]]

[[ log("Before Whitelist Info Admin"+CR) ]]

[[ if MailwasherRequest ]]
[[ var WhitelistSummary1Text = "You have requested Mailwasher Whitelist Information for " + EzineNameAndDescription + ". This email provides that information." ]]
[[ elseif WhitelistInfoRequest ]]
[[ var WhitelistSummary1Text = "You have requested Whitelist Information for " + EzineNameAndDescription + ". This email provides that information." ]]
[[ elseif ConfirmRequest ]]
[[ var WhitelistSummary1Text = "You have confirmed a subscription to " + EzineNameAndDescription + ". This email provides extra information about 'Whitelisting' addresses to ensure your ISP and Spam Filters do not block our mailings." ]]
[[ else ]]
[[ rem presume it is a subscription request ]]
[[ var WhitelistSummary1Text = "You have requested a subscription to " + EzineNameAndDescription + ". This email provides extra information about 'Whitelisting' addresses to ensure your ISP and Spam Filters do not block our mailings." ]]
[[ endif ]]

[[ var HeaderReplyToAddress = HeaderReplyToAddressWhitelist ]]
[[ var ISPFound = TRUE ]]
[[ var ISPSpecific = TRUE ]]

[[ if DomainNameLC = "aol.com" ]]
[[ var ResponseFileName = "Whitelist AOL.txt" ]]
[[ var ISPName = "AOL" ]]

[[ elseif DomainNameLC = "comcast.net" ]]
[[ var ResponseFileName = "BOOGER" ]]
[[ var ISPName = "Comcast" ]]
[[ var ISPSpecific = FALSE ]]

[[ elseif DomainNameLC = "att.net" or DomainNameLC = "worldnet.att.net" ]]
[[ var ResponseFileName = "BOOGER" ]]
[[ var ISPName = "AT&T Worldnet" ]]
[[ var ISPSpecific = FALSE ]]

[[ elseif DomainNameLC = "earthlink.net" ]]
[[ var ResponseFileName = "Whitelist Earthlink.txt" ]]
[[ var ISPName = "Earthlink" ]]

[[ elseif DomainNameLC = "gmail.com" ]]
[[ var ResponseFileName = "Whitelist GMail.txt" ]]
[[ var ISPName = "GMail" ]]

[[ elseif DomainNameLC = "hotmail.com" ]]
[[ var ResponseFileName = "Whitelist Hotmail.txt" ]]
[[ var ISPName = "Hotmail" ]]

[[ elseif DomainNameLC = "mindspring.com" ]]
[[ var ResponseFileName = "Whitelist Earthlink.txt" ]]
[[ var ISPName = "Earthlink (Mindspring)" ]]

[[ elseif DomainNameLC = "msn.com" ]]
[[ var ResponseFileName = "BOOGER" ]]
[[ var ISPName = "MSN" ]]
[[ var ISPSpecific = FALSE ]]

[[ elseif DomainNameLC = "myvzw.com" ]]
[[ var ResponseFileName = "BOOGER" ]]
[[ var ISPName = "Verizon Wireless" ]]
[[ var ISPSpecific = FALSE ]]

[[ elseif DomainNameLC = "sbcglobal.net" ]]
[[ var ResponseFileName = "BOOGER" ]]
[[ var ISPName = "SBC" ]]
[[ var ISPSpecific = FALSE ]]

[[ elseif DomainNameLC = "sprintmail.com" ]]
[[ var ResponseFileName = "Whitelist Earthlink.txt" ]]
[[ var ISPName = "Earthlink (SprintMail)" ]]

[[ elseif DomainNameLC = "yahoo.com" ]]
[[ var ResponseFileName = "Whitelist Yahoo.txt" ]]
[[ var ISPName = "Yahoo" ]]

[[ elseif MailwasherRequest ]]
[[ var ResponseFileName = "Whitelist Mailwasher.txt" ]]
[[ var ISPName = "Mailwasher" ]]

[[ else ]]
[[ var ResponseFileName = "BOOGER" ]]
[[ var ISPName = "BOOGER" ]]
[[ var ISPFound = FALSE ]]
[[ var ISPSpecific = FALSE ]]

[[ var ResponseFileName = "Whitelist General.txt" ]]

[[ endif ]]


[[ var ThreeEmails = FALSE ]]

[[ if DomainNameLC = "aol.com" or MailwasherRequest ]]

[[ var ThreeEmails = TRUE ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + ResponseFileName ]]
[[ var HeaderSubject1 = "Please Whitelist This Address in " + ISPName + " - " ]]

[[ var EzineWhitelistAddress = EzineAdminAddress ]]
[[ var EzineWhitelistAddressPurpose = EzineAdminAddressPurpose ]]

[[ var HeaderSenderAddress = SenderAddressText + " <" + EzineWhitelistAddress + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ var HeaderSubjectMain = HeaderSubject1 + EzineWhitelistAddress ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]

[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]


[[ rem If this is a confirm request from a second email address, ]]
[[ rem send the second email ]]

[[ if ConfirmDoubleResponse ]]

[[ rem Where to send it to depends . . . ]]
[[ rem on whether the record was found in the DB ]]

[[ if ConfirmDBRecordFound ]]

[[ rem Record found: use the data from the record ]]

[[ let -Recipient- = FullEmailAddress ]]

[[ else ]]

[[ rem Record NOT found: use the data from the confirmation request record ]]

[[ let -Recipient- = RequestEmail ]]

[[ endif ]]

[[ rem Send the second email ]]

[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ endif ]]




[[ var EzineWhitelistAddress = EzineDeliveryAddress ]]
[[ var EzineWhitelistAddressPurpose = EzineDeliveryAddressPurpose ]]

[[ var HeaderSenderAddress = SenderAddressText + " <" + EzineWhitelistAddress + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ var HeaderSubjectMain = HeaderSubject1 + EzineWhitelistAddress ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]

[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]



[[ rem If this is a confirm request from a second email address, ]]
[[ rem send the second email ]]

[[ if ConfirmDoubleResponse ]]

[[ rem Where to send it to depends . . . ]]
[[ rem on whether the record was found in the DB ]]

[[ if ConfirmDBRecordFound ]]

[[ rem Record found: use the data from the record ]]

[[ let -Recipient- = FullEmailAddress ]]

[[ else ]]

[[ rem Record NOT found: use the data from the confirmation request record ]]

[[ let -Recipient- = RequestEmail ]]

[[ endif ]]

[[ rem Send the second email ]]

[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ endif ]]




[[ var EzineWhitelistAddress = EzinePersonalSendAddress ]]
[[ var EzineWhitelistAddressPurpose = EzinePersonalSendAddressPurpose ]]

[[ var HeaderSenderAddress = SenderAddressText + " <" + EzineWhitelistAddress + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ var HeaderSubjectMain = HeaderSubject1 + EzineWhitelistAddress ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]

[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ var ResponseFileName = "Whitelist General.txt" ]]

[[ endif ]]


[[ if ISPSpecific ]]
[[ var HeaderSubjectMain = "Please Whitelist These Addresses in " + ISPName ]]
[[ else ]]
[[ var HeaderSubjectMain = "Please Whitelist These Addresses (Long 'General' Info)" ]]
[[ var ResponseFileName = "Whitelist General.txt" ]]
[[ endif ]]

[[ var LoopAgain = TRUE ]]

[[ while LoopAgain ]]

[[ var ResponseFileNameFull = GeneralTextFileBase + ResponseFileName ]]

[[ var HeaderSenderAddress = SenderAddressText + " <" + EzineAdminAddress + ">" ]]
[[ var HeaderFromAddress = HeaderSenderAddress ]]
[[ var HeaderSubject = EzineSubjectTag + " " + HeaderSubjectMain ]]

[[ let -Recipient- = RecipientMod ]]
[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]



[[ rem If this is a confirm request from a second email address, ]]
[[ rem send the second email ]]

[[ if ConfirmDoubleResponse ]]

[[ rem Where to send it to depends . . . ]]
[[ rem on whether the record was found in the DB ]]

[[ if ConfirmDBRecordFound ]]

[[ rem Record found: use the data from the record ]]

[[ let -Recipient- = FullEmailAddress ]]

[[ else ]]

[[ rem Record NOT found: use the data from the confirmation request record ]]

[[ let -Recipient- = RequestEmail ]]

[[ endif ]]

[[ rem Send the second email ]]

[[ var DisplayRecipient = -Recipient- ]]
[[ incoming_autorespond() ]]

[[ rem Conditionally copy me ]]
[[ if CopyToMe ]]
[[ let -Recipient- = AddressToCopyMe ]]
[[ incoming_autorespond() ]]
[[ endif ]]

[[ endif ]]


[[ if ResponseFileName = "Whitelist General.txt" ]]
[[ var LoopAgain = FALSE ]]
[[ else ]]
[[ var ResponseFileName = "Whitelist General.txt" ]]
[[ var HeaderSubjectMain = "Please Whitelist These Addresses (Long 'General' Info)" ]]
[[ endif ]]

[[ endw ]]

[[ rem end of processing ]]

[[ endif ]]

[[ rem ---------- end of process whitelist info request ---------- ]]




[[ rem ========== DELETE THE INCOMING RECORD FROM THE POP FILE ========== ]]

[[ incoming_delete(TRUE) ]]

[[ rem ---------- end of delete the incoming record from the pop file ---------- ]]




[[ rem

KNOWN ISSUES:

1. middle name extraction
doesn't work on names like John Billy Bob Billy. The first "Billy" terminates the search for a middle name.



]]




Saturday, June 25, 2011

Check out my Information mall. Sure you might be able to find the stuff for free but who has that kind of time. Organized information is saves time and that is worth money.

Thursday, March 18, 2010