%
'*************************************************************************
' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK!
' Function : Sends email
' Product : CandyPress Store Frontend
' Version : 2.5
' Modified : February 2004
' Copyright: Copyright (C) 2004 CandyPress.Com
' See "license.txt" for this product for details regarding
' licensing, usage, disclaimers, distribution and general
' copyright requirements. If you don't have a copy of this
' file, you may request one at webmaster@candypress.com
'*************************************************************************
'*************************************************************************
'Forward email send request to appropriate component
'*************************************************************************
Function sendMail(fromName, fromEmail, toEmail, subject, body, contType)
'Ignore email errors if not in debug mode
if UCase(debugMode) <> "Y" then
on error resume next
end if
select case mailComp
case "1" 'JMail
call JMail(fromName, fromEmail, toEmail, subject, body, contType)
case "2" 'CDONTS
call CDONTS(fromName, fromEmail, toEmail, subject, body, contType)
case "3" 'Persits ASPEmail
call PASPEmail(fromName, fromEmail, toEmail, subject, body, contType)
case "4" 'ServerObjects ASPMail
call SOASPMail(fromName, fromEmail, toEmail, subject, body, contType)
case "5" 'Bamboo SMTP
call bamboo(fromName, fromEmail, toEmail, subject, body, contType)
case "6" 'CDOSYS
call CDOSYS(fromName, fromEmail, toEmail, subject, body, contType)
end select
on error goto 0
end Function
'JMail (v4.3)
Function JMail(fromName, fromEmail, toEmail, subject, body, contType)
dim mail,I
set mail = server.CreateObject("JMail.Message")
'mail.Charset = "iso-2022-jp"
'mail.ContentTransferEncoding = "quoted-printable"
mail.From = fromEmail
mail.FromName = fromName
mail.silent = false
mail.Subject = subject
mail.Body = body
if contType = 1 then 'Send HTML Email
mail.ContentType = "text/html"
end if
if isArray(toEmail) then 'Send Multiple Emails
for I = 0 to Ubound(toEmail)
if len(toEmail(I)) > 0 then
mail.ClearRecipients()
mail.AddRecipient toEmail(I)
mail.Send(pSmtpServer)
end if
next
else 'Send Single Email
mail.AddRecipient toEmail
mail.Send(pSmtpServer)
end if
set mail = nothing
end Function
'CDONTS
'Note : After the "Send" method, the "NewMail" object becomes invalid.
' We therefore have to create the "NewMail" object for each email.
Function CDONTS(fromName, fromEmail, toEmail, subject, body, contType)
dim mail,I
if isArray(toEmail) then 'Send Multiple Emails
for I = 0 to Ubound(toEmail)
if len(toEmail(I)) > 0 then
Set mail = Server.CreateObject ("CDONTS.NewMail")
if contType = 1 then 'Send HTML Email
mail.BodyFormat = 0
mail.MailFormat = 0
end if
mail.Send fromEmail & " (" & fromName & ")", toEmail(I), subject, body
set mail = nothing
end if
next
else 'Send Single Email
Set mail = Server.CreateObject ("CDONTS.NewMail")
if contType = 1 then 'Send HTML Email
mail.BodyFormat = 0
mail.MailFormat = 0
end if
mail.Send fromEmail & " (" & fromName & ")", toEmail, subject, body
set mail = nothing
end if
end Function
'Persits ASP Email
Function PASPEmail(fromName, fromEmail, toEmail, subject, body, contType)
dim mail,I
set mail = server.CreateObject("Persits.MailSender")
'mail.Charset = "iso-2022-jp"
'mail.ContentTransferEncoding = "quoted-printable"
mail.Host = pSmtpServer
mail.From = fromEmail
mail.FromName = fromName
mail.Subject = subject
mail.Body = body
'mail.Timestamp = now()
'mail.Queue = True
mail.Port = 587
mail.Username = "herbalife@ahw.com.br"
mail.Password = "Ac_201051"
if contType = 1 then 'Send HTML Email
mail.IsHTML = True
end if
if isArray(toEmail) then 'Send Multiple Emails
for I = 0 to Ubound(toEmail)
if len(toEmail(I)) > 0 then
mail.Reset
mail.AddAddress toEmail(I)
mail.Send
end if
next
else 'Send Single Email
mail.AddAddress toEmail
mail.Send
end if
set mail = nothing
end Function
'ServerObjects ASPMail
Function SOASPMail(fromName, fromEmail, toEmail, subject, body, contType)
dim mail,I
set mail = server.CreateObject("SMTPsvg.Mailer")
mail.RemoteHost = pSmtpServer
mail.FromAddress = fromEmail
mail.FromName = fromName
mail.Subject = subject
mail.BodyText = body
if contType = 1 then 'Send HTML Email
mail.ContentType = "text/html"
end if
if isArray(toEmail) then 'Send Multiple Emails
for I = 0 to Ubound(toEmail)
if len(toEmail(I)) > 0 then
mail.ClearRecipients
mail.AddRecipient "", toEmail(I)
mail.SendMail
end if
next
else 'Send Single Email
mail.AddRecipient "", toEmail
mail.SendMail
end if
set mail = nothing
end Function
'Bamboo SMTP
Function bamboo(fromName, fromEmail, toEmail, subject, body, contType)
dim mail,I
set mail = Server.CreateObject("Bamboo.SMTP")
mail.Server = pSmtpServer
mail.From = fromEmail
mail.FromName = fromName
mail.Subject = subject
mail.Message = body
if contType = 1 then 'Send HTML Email
mail.ContentType = "text/html"
end if
if isArray(toEmail) then 'Send Multiple Emails
for I = 0 to Ubound(toEmail)
if len(toEmail(I)) > 0 then
mail.Rcpt = toEmail(I)
mail.Send
end if
next
else 'Send Single Email
mail.Rcpt = toEmail
mail.Send
end if
set mail = nothing
end Function
'CDOSYS
Function CDOSYS(fromName, fromEmail, toEmail, subject, body, contType)
dim mail,conf,I,erro
'Configure the server
Set conf = Server.CreateObject("CDO.Configuration")
conf.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
conf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = pSmtpServer
conf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
conf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
conf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
conf.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "anew@ahw.com.br"
conf.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Ac_201056#!"
conf.Fields.Update
'Send email
Set mail = Server.CreateObject("CDO.Message")
mail.Configuration = conf
mail.BodyPart.Charset = "UTF-8"
mail.From = fromName & " <" & fromEmail & ">"
mail.Subject = subject
if contType = 1 then 'Send HTML Email
mail.HTMLBody = body
else
mail.TextBody = body
end if
if isArray(toEmail) then 'Send Multiple Emails
for I = 0 to Ubound(toEmail)
if len(toEmail(I)) > 0 then
mail.To = toEmail(I)
On Error Resume Next
mail.Send
end if
next
else 'Send Single Email
mail.To = toEmail
On Error Resume Next
mail.Send
end if
If Err <> 0 Then
erro = " Erro ao enviar a mensagem.
"
erro = erro & "Erro.Description: " & Err.Description & "
"
erro = erro & "Erro.Number: " & Err.Number & "
"
erro = erro & "Erro.Source: " & Err.Source & "
"
response.write erro
End If
'Clean up
set mail = nothing
set conf = nothing
end Function
%>