Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a bcc in Send mail 2

Status
Not open for further replies.

VitoCorleone

Programmer
Jun 22, 2004
28
GB
Here is my code and i want to know how i can create a bcc when the sendmail function is used in asp

i have a hidden field on the previous page with my email address. and a field where the user enters their email add, the send page picks up those variables and sends to email which is their email add, but how do i add my hidden field.



<%
'sets variables
email = request.form("email")
'chooses username and password from database that correspond to submitted email address.
user = objrs.Fields("userid")
pass = objrs.Fields("pw")
Set sendmail = Server.CreateObject("CDONTS.NewMail")
'put the webmaster address here
sendmail.From = "josephine.renner@bt.com"
'The mail is sent to the address entered in the previous page.
sendmail.To = email
'Enter the subject of your mail here
sendmail.Subject = "Access to GS Finance Reports"
'This is the content of thr message.
sendmail.Body = "You can login GS Finance by entering your username and password." & vbCrlf & vbCrlf _
& "Username = " & user & vbCrlf _
& "password = " & pass & vbCrlf
'this sets mail priority.... 0=low 1=normal 2=high
sendmail.Importance = 2
sendmail.Send
%>

<span class="content">Your login information has been mailed to <%=email%>.<br>
You should receive it shortly.
<%
' Close Data Access Objects and free DB variables
objDC.Close
Set objRS = Nothing
Set objDC = Nothing
Set sendmail = Nothing
%>
<%end if%>
 
Hi Topshotter

Code:
<%
   'sets variables
email = request.form("email")
   'chooses username and password from database that correspond to submitted email address.
user = objrs.Fields("userid")
pass = objrs.Fields("pw")
Set sendmail = Server.CreateObject("CDONTS.NewMail")
   'put the webmaster address here
sendmail.From = "josephine.renner@bt.com"
   'The mail is sent to the address entered in the previous page.
sendmail.To = email
   'Enter the subject of your mail here
''''''''''''''''''''''''''''''''''''''''''''''''''
sendmail.bcc = Request.Form("HIDDENFIELDNAME")
''''''''''''''''''''''''''''''''''''''''''''''''''
sendmail.Subject = "Access to GS Finance Reports"
   'This is the content of thr message.
sendmail.Body = "You can login GS Finance by entering your username and password." & vbCrlf & vbCrlf _
& "Username = " & user & vbCrlf _
& "password = " & pass & vbCrlf
   'this sets mail priority.... 0=low 1=normal 2=high
sendmail.Importance = 2
sendmail.Send
%>
      
  <span class="content">Your login information has been mailed to <%=email%>.<br>
  You should receive it shortly.
  <%
   ' Close Data Access Objects and free DB variables
    objDC.Close
    Set objRS =  Nothing
    Set objDC = Nothing
    Set sendmail = Nothing
%>
  <%end if%>

Hope this helps......

Glen
Conception | Execution
 
Why do you have your email address in a hidden field on the form page? This will be visible to anyone who views the source.

You might as well include it on the page that sends the email instead:

Code:
sendmail.bcc = "youremailaddress@somewhere.com"

Tony
________________________________________________________________________________
 
LOL you are right though, it would be much easier to hardcode that or make it a constant than waste valuable bytes posting a hidden field.....

:)

Glen
Conception | Execution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top