%
sub mail(from, mailto, cc, bcc, subject, intro, fields, labels, echo)
message=intro
if isarray(fields) then
for i=0 to ubound(fields)
value=Trim(Replace(Request.Form.item(fields(i)),"'","""))
message=message & "" & labels(i) & ": " & value & "
"
next
end if
if echo=1 then Response.Write message
Dim sendmail, SM_mComp, SM_smtpServer, SM_contentType, SM_priority
sendmail = ""
SM_priority = 3
SM_contentType = "text/html"
dim email, addrList, addr
if emailcomp = "CDO" then
Set email = CreateObject("CDO.Message")
email.Sender = from
email.To = mailto
if cc<>"" then email.cc = cc
if bcc<>"" then email.Bcc = bcc
email.Subject = subject
email.HTMLBody = message
email.Send
Set email = nothing
end if
if emailcomp = "CDONTS" then
set email = Server.CreateObject("CDONTS.NewMail")
if SM_contentType = "text/html" then
email.BodyFormat = 0
email.MailFormat = 0
end if
email.From = from
email.To = mailto
if cc<>"" then email.cc = cc
if bcc<>"" then email.Bcc = bcc
email.Subject = subject
email.Body = message
email.Send
Set email = nothing
end if
' Send email (JMail version).
if emailcomp = "JMail" then
set email = Server.CreateObject("JMail.SMTPMail")
email.Silent = true
email.ServerAddress = popserver
email.Sender = from
if SM_replyTo <> "" then email.ReplyTo = SM_replyTo
email.Subject = subject
addrList = Split(mailto, ";")
for each addr in addrList
email.AddRecipient Trim(addr)
next
addrList = Split(cc, ";")
for each addr in addrList
email.AddRecipientCC Trim(addr)
next
addrList = Split(bcc, ";")
for each addr in addrList
email.AddRecipientBCC Trim(addr)
next
email.ContentType = SM_contentType
email.Priority = SM_priority
email.Body = message
email.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
if not email.Execute then
SendMail = "Email send failed: " & email.ErrorMessage & "."
end if
end if
if emailcomp = "ASPEmail" then
set email = Server.CreateObject("Persits.MailSender")
email.From = from
' email.FromName = SM_fromName
email.Host = popserver
if SM_replyTo <> "" then email.AddReplyTo = SM_replyTo
addrList = Split(mailto, ";")
for each addr in addrList
email.AddAddress Trim(addr)
next
addrList = Split(cc, ";")
for each addr in addrList
email.AddCC Trim(addr)
next
addrList = Split(bcc, ";")
for each addr in addrList
email.AddBCC Trim(addr)
next
email.Subject = subject
email.IsHTML = (SM_contentType = "text/html")
email.Priority = SM_priority
email.Body = message
email.AddCustomHeader "Originating-IP: " & Request.ServerVariables("REMOTE_ADDR")
On Error Resume Next
email.Send
if Err > 0 then
SendMail = "Email send failed: " & Err.Description & " (" & Err & ")."
end if
end if
if emailcomp = "ASPmail" then
set email = Server.CreateObject("SMTPsvg.Mailer")
email.FromAddress = from
' email.FromName = SM_fromName
email.RemoteHost = popserver
if SM_replyTo <> "" then email.AddReplyTo = SM_replyTo
addrList = Split(mailto, ";")
for each addr in addrList
email.AddRecipient Trim(addr),Trim(addr)
next
addrList = Split(cc, ";")
for each addr in addrList
email.AddCC Trim(addr),Trim(addr)
next
addrList = Split(bcc, ";")
for each addr in addrList
email.AddBCC Trim(addr),Trim(addr)
next
email.Subject = subject
email.ContentType = SM_contentType
email.Priority = SM_priority
email.BodyText = message
email.AddExtraHeader "Originating-IP: " & Request.ServerVariables("REMOTE_ADDR")
if email.SendMail then
SendMail = "Email send failed: " & email.Response
end if
end if
' Display email (HTML version).
if emailcomp = "NoMail" then
SendMail = "
| Email Message | |
|---|---|
| " &_ " | |
| From: | " & from &" |
| Date: | " & xdate &_ " |
| To: | "
for each addr in addrList
SendMail = SendMail & Trim(addr) & " " next SendMail = SendMail & " |
| CC: | "
for each addr in addrList
SendMail = SendMail & Trim(addr) & " " next SendMail = SendMail & " |
| BCC: | "
for each addr in addrList
SendMail = SendMail & Trim(addr) & " " next SendMail = SendMail & " |
| Subject: | " &_ subject & " |
| " if SM_contentType = "text/html" then SendMail = SendMail & message else SendMail = SendMail & SM_FormatStr(message) end if SendMail = SendMail & " | |