Hello, i use on my webpage a form, submit by email to my office and my home emailadresse.
This part of the job runs very well. As mentioned at the of the code the sender of the email should receive a carbon copy of the sent email.
This part of the job doesn't work. What or where do I have to modifiy my code?? Or are there any other solutions?
Thanks in advance for your help.
Regards and have a nice weekend
Lupo WEB Designer & WEB Developer (as per my working contract) and especially ASP Newbie
This part of the job runs very well. As mentioned at the of the code the sender of the email should receive a carbon copy of the sent email.
This part of the job doesn't work. What or where do I have to modifiy my code?? Or are there any other solutions?
Code:
<%
Response.Buffer = True
'Dimension variables
'Holds the body of the e-mail
Dim strBody
'Holds the subject line of the e-mail
Dim strSubject
'Holds the mail server object
Dim objCDOMail
'Holds my office e-mail address
Dim strMyEmailAddress
'Holds any carbon copy e-mail addresses
Dim strCCEmailAddress
'Holds any blind copy e-mail addresses
Dim strBCCEmailAddress
'Holds the return e-mail address of the user
Dim strReturnEmailAddress
'-- My e-mail address --
strMyEmailAddress = "MyEmail@office.com"
'-- Carbon Copy e-mail address, separated by ; --
strCCEmailAddress = "MyEmail@home.com"
'-- Blind Copy e-mail address, separated by ; --
strBCCEmailAddress = ""
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")
'Initialse strSubject string with the Subject line of the e-mail
strSubject = strSubject & Request.Form("subject")
'Initialse strBody string with the body of the e-mail
strBody = strBody & "<br>E-mailaddress: " & strReturnEmailAddress
strBody = strBody & "<br><br>Message: <br>" & Replace(Request.Form("enquiry"), vbCrLf, "<br>")
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise the e-mail will be rejected
If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to my own
strReturnEmailAddress = strMyEmailAddress
End If
'Send the e-mail
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Who the e-mail is from
objCDOMail.From = Request.Form("firstName") & " " & Request.Form("lastName") & " <" & strReturnEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress
'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress
'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress
'Set the subject of the e-mail
objCDOMail.Subject = strSubject
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the mail format (0=MIME 1=Text)
objCDOMail.MailFormat = 0
'Set the main body of the e-mail
objCDOMail.Body = strBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
'Send the e-mail
objCDOMail.Send
'Close the server object
Set objCDOMail = Nothing
%>
<!doctype html public "-//W3C//DTD HTML 4.0 transitional//EN">
<html>
<head>
</head>
<body>
<!-- Confirmation -->
Your message has been submitted and you will find a copy in your mailbox shortly.
</body>
</html>
Thanks in advance for your help.
Regards and have a nice weekend
Lupo WEB Designer & WEB Developer (as per my working contract) and especially ASP Newbie