<%
dim gBodyFormat, gOneToAddress
gBodyFormat = ""
gOneToAddress = false
function WAUE_AddAttachment(mailObj,attPath)
if (WAUE_isAttachment(attPath)) then
mailObj.AddAttachment attPath
end if
set WAUE_AddAttachment = mailObj
end function
function WAUE_SetCharset(mailObj,charSet)
mailObj.CharSet = charSet
set WAUE_SetCharset = mailObj
end function
function WAUE_AddBCC(mailObj,bccEmail)
if (bccEmail <> "") then
emailArr = Split(cStr(bccEmail), ";")
for bcc=0 to UBound(emailArr)
if (InStr(cStr(emailArr(bcc)), "@")) then
emailArr2 = Split(cStr(emailArr(bcc)), "|WA|")
if (UBound(emailArr2) = 0) then
if (WAUE_isEmailAddress(emailArr(bcc))) then
mailObj.AddBCC WA_StripSpaces(cStr(emailArr(bcc)))
end if
else
if (InStr(emailArr2(1), "@")) then
if (WAUE_isEmailAddress(emailArr2(1))) then
mailObj.AddBCC WA_StripSpaces(emailArr2(1)), WA_TrimLeadingSpaces(emailArr2(0))
end if
else
if (WAUE_isEmailAddress(emailArr2(0))) then
mailObj.AddBCC WA_StripSpaces(emailArr2(0)), WA_TrimLeadingSpaces(emailArr2(1))
end if
end if
end if
end if
next
end if
set WAUE_AddBCC = mailObj
end function
function WAUE_AddCC(mailObj,ccEmail)
if (ccEmail <> "") then
emailArr = Split(cStr(ccEmail), ";")
for cc=0 to UBound(emailArr)
if (InStr(cStr(emailArr(cc)), "@")) then
emailArr2 = Split(cStr(emailArr(cc)), "|WA|")
if (UBound(emailArr2) = 0) then
if (WAUE_isEmailAddress(emailArr(cc))) then
mailObj.AddCC WA_StripSpaces(cStr(emailArr(cc)))
end if
else
if (InStr(emailArr2(1), "@")) then
if (WAUE_isEmailAddress(emailArr2(1))) then
mailObj.AddCC WA_StripSpaces(emailArr2(1)), WA_TrimLeadingSpaces(emailArr2(0))
end if
else
if (WAUE_isEmailAddress(emailArr2(0))) then
mailObj.AddCC WA_StripSpaces(emailArr2(0)), WA_TrimLeadingSpaces(emailArr2(1))
end if
end if
end if
end if
next
end if
set WAUE_AddCC = mailObj
end function
function WAUE_AddRecipient(mailObj,recEmail)
if (recEmail <> "") then
emailArr = Split(cStr(recEmail), ";")
for rec=0 to UBound(emailArr)
if (InStr(cStr(emailArr(rec)), "@")) then
emailArr2 = Split(cStr(emailArr(rec)), "|WA|")
if (UBound(emailArr2) = 0) then
if (WAUE_isEmailAddress(emailArr(rec))) then
mailObj.AddAddress WA_StripSpaces(cStr(emailArr(rec)))
gOneToAddress = true
end if
else
if (InStr(emailArr2(1), "@")) then
if (WAUE_isEmailAddress(emailArr2(1))) then
mailObj.AddAddress WA_StripSpaces(emailArr2(1)), WA_TrimLeadingSpaces(emailArr2(0))
gOneToAddress = true
end if
else
if (WAUE_isEmailAddress(emailArr2(0))) then
mailObj.AddAddress WA_StripSpaces(emailArr2(0)), WA_TrimLeadingSpaces(emailArr2(1))
gOneToAddress = true
end if
end if
end if
end if
next
end if
set WAUE_AddRecipient = mailObj
end function
function WAUE_BodyFormat(mailObj,bodyFormat)
if (bodyFormat = 0 OR bodyFormat = 2) then
mailObj.IsHTML = true
end if
gBodyFormat = bodyFormat
set WAUE_BodyFormat = mailObj
end function
function WAUE_Definition(remHost,port,login,pword)
set retVal = Server.CreateObject("Persits.MailSender")
retVal.Host = remHost
if (port <> "") then
retVal.Port = cInt(port)
end if
if (login <> "") then
retVal.UserName = login
retVal.Password = pword
end if
gOneToAddress = false
set WAUE_Definition = retVal
end function
function WAUE_SendMail(mailObj,mailAttachments,mailBCC,mailCC,mailTo,mailImportance,mailFrom,mailSubject,mailBody)
if (gOneToAddress) then
if (InStr(mailFrom, "|WA|")) then
dim mailFromArr
mailFromArr = Split(mailFrom, "|WA|")
for f=0 to UBound(mailFromArr)
if (InStr(cStr(mailFromArr(f)), "@")) then
mailObj.From = mailFromArr(f)
else
mailObj.FromName = mailFromArr(f)
end if
next
else
mailObj.From = mailFrom
end if
if (gBodyFormat = 2) then
mailBodyArray = Split(mailBody, "<multipartbreak>")
mailBody = mailBodyArray(1)
mailObj.AltBody = mailBodyArray(0)
end if
mailObj.Body = mailBody
mailObj.Subject = mailSubject
mailObj.Send()
end if
set WAUE_SendMail = mailObj
end function
function WAUE_SetImportance(mailObj,Importance)
dim newPriority
newPriority = 3
if (NOT IsNumeric(Importance)) then
if (UCase(Importance) = "HIGH") then
newPriority = 1
end if
if (UCase(Importance) = "LOW") then
newPriority = 5
end if
else
newPriority = cInt(Importance)
end if
mailObj.Priority = newPriority
set WAUE_SetImportance = mailObj
end function%>