Using Persits mailsender need to AddBcc to an email address from a database

'Create Email
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtp host"
Mail.Username = "username"
Mail.Password = "password"
Mail.AddBcc  this is where I need it to pull one address out of DB based on unique ID from recordset
Mail.From = ""
Mail.FromName = "FromName"
Mail.Subject = "Subject"
Mail.Body = EmailContent

Mail.IsHTML = True
LVL 12
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

netsmithcentralConnect With a Mentor Author Commented:
Due to the need to grab only one Email address based on the ID associated with the form data being submitted,  the form submit page needs to redirect to an asp page with the following code:

Dim rsBCCs__MMColParam
rsBCCs__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
  rsBCCs__MMColParam = Request.QueryString("ID")
End If
Dim rsBCCs
Dim rsBCCs_cmd
Dim rsBCCs_numRows
Set rsBCCs_cmd = Server.CreateObject ("ADODB.Command")
rsBCCs_cmd.ActiveConnection = MM_BACKEND_STRING
rsBCCs_cmd.CommandText = "SELECT * FROM tblFORMWHERE ID = ?"
rsBCCs_cmd.Prepared = true
rsBCCs_cmd.Parameters.Append rsBCCs_cmd.CreateParameter("param1", 5, 1, -1, rsBCCs__MMColParam) ' adDouble
Set rsBCCs = rsBCCs_cmd.Execute
rsBCCs_numRows = 0

 'Email HTML
EmailContent = "<body bgcolor='#FFFFFF'>" _
& "<div align='left'>&nbsp;</div>" _
& "<p>Email messagep>" _
& "<p>More email message and link<a href='' target='_blank'> here.</a></p></body>"

'Create Email and Add BCC Here
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "serverIP"
Mail.Username = "username"
Mail.Password = "password"
Mail.AddBcc ""
Mail.AddBcc rsBCCs("Email")
Mail.From = ""
Mail.FromName = "No Reply"
Mail.Subject = "New Email"
Mail.Body = EmailContent

Mail.IsHTML = True

Set rsBCCs = Nothing
<% Response.Redirect("thankyou.asp")%>
Om PrakashCommented:
You can connect to DB and get the same

set conn=Server.CreateObject("ADODB.Connection")
conn.Open "c:/webdata/northwind.mdb"

set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT bcc_field FROM Customers where condition = 'test'", conn
Dim bccField
if not rs.EOF then
   bccField = rs("bcc_field")   
end if

'Add BCC here
Mail.AddBcc  = bccField 

Open in new window

netsmithcentralAuthor Commented:
thanks om_prakash_p
but I get the following:

Microsoft VBScript runtime  error '800a01b6'

Object doesn't support this property or method: 'Mail.AddBcc'
All Courses

From novice to tech pro — start learning today.