Hi im doing a ASP contact form and for some reason i keep getting this.
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/confirmation.asp, line 10
800401f3
I think that theres something wrong with my SMTP, please any help would be grateful.
<%
DIM strEmail, strFirstName, strLastName, strSubject, strComments
strEmail = request.form("Email")
strFirstName = request.form("FirstName")
strLastName = request.form("LastName")
strSubject = request.form("Subject")
strComments = request.form("Comments")
DIM Mailer,strMsgHeader, qryItem, strMsgInfo
Set Mailer = Server.CreateObject("smtpout.secureserver.net")//this line might be wrong.
Mailer.FromName = "Web Designs"
Mailer.FromAddress= "carlos#example.net"
Mailer.ReplyTo = strEmail
Mailer.RemoteHost = "mail.example.net"
Mailer.AddRecipient "", ""
Mailer.Subject = "Online Inquiry"
strMsgHeader = "This mail message was sent from the Online Form" & vbCrLf & vbCrLf
Mailer.BodyText = strMsgHeader & vbCrLf & "Email: " & Request.Form("Email") & _
vbCrLf & "First Name: " & Request.Form("FirstName") & _
vbCrLf & "Last Name: " & Request.Form("LastName") & _
vbCrLf & "Subject: " & Request.Form("Subject") & _
vbCrLf & "Comments: " & Request.Form("Comments")
IF Mailer.SendMail THEN
Response.Write strFirstName & ",<br>"
Response.Write "Your message has been successfully sent."
ELSE
Response.Write "The following error occurred while sending your message: " & Mailer.Response
END IF
%>
It seems you mix up the 'send email library' and your SMTP configuration.
the Mailer should look like
Set Mailer = Server.CreateObject("CDO.Message")
(although this could depend on your IIS version)
To configure your SMTP you should use this object:
Set cdoConfig = CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(cdoSMTPServer) = "smtpout.secureserver.net"
Edit: example code: CDO Classic ASP form not working
Related
So I have an asp.net server running on discountasp.net and for whatever reason when I just published the new version of the website it stopped sending emails. I tried changing the code back to exactly how it was done in the old website and it didn't work. I've tried many other solutions to no avail. Here's the old code:
Dim message As New MailMessage
message.IsBodyHtml = True
message.From = New MailAddress("example#mydomain.com", "inquiry#mydomain.com")
If Me.ddlSendTo.SelectedValue = 1 Then
message.To.Add(New MailAddress("sales#mydomain.com"))
message.Subject = "Sales Inquiry From mydomain.com"
ElseIf Me.ddlSendTo.SelectedValue = 2 Then
message.To.Add(New MailAddress("support#mydomain.com"))
message.Subject = "Support Question From mydomain.com"
End If
Dim sb As New StringBuilder()
sb.Append("The following message was sent from a user of our website as a request for more information.<br/><br/>")
sb.Append("Here is the message they sent:<br/><br/>")
sb.Append("Sender's Name: " & Me.txtSenderName.Text & "<br/>")
sb.Append("Senders Email: <a href='mailto:" & Me.txtSenderEmail.Text & "'>" & Me.txtSenderEmail.Text & "</a><br/>")
sb.Append("Company Name: " & Me.txtCompany.Text & "<br/>")
sb.Append("Phone Number: " & Me.txtPhone.Text & "<br/><br/>")
sb.Append("Subject: " & Me.txtSubject.Text & "<br/>")
sb.Append("Message: " & Me.txtEmailMsg.Text)
message.Body = sb.ToString()
Try
Dim client As New SmtpClient()
client.Host = "localhost"
client.Send(message)
Catch ex As SmtpException
Me.errors.InnerHtml = ex.Message & " local host message"
Return
End Try
Here's my current iteration that is still not working:
Dim toEmail As String
Dim subject As String
If Me.ddlSendTo.SelectedValue = 1 Then
If isTesting() Then
toEmail = GetTesterEmail()
Else
toEmail = "sales#mydomain.com"
End If
subject = "Sales Inquiry From MyDomain.com"
ElseIf Me.ddlSendTo.SelectedValue = 2 Then
If isTesting() Then
toEmail = GetTesterEmail()
Else
toEmail = "support#mydomain.com"
End If
subject = "Support Question From MyDomain.com"
End If
Dim sb As New StringBuilder()
sb.Append("The following message was sent from a user of our website as a request for more information.<br/><br/>")
sb.Append("Here Is the message they sent:<br/><br/>")
sb.Append("Sender's Name: " & Me.txtName.Value & "<br/>")
sb.Append("Senders Email: <a href='mailto:" & Me.txtEmail.Value & "'>" & Me.txtEmail.Value & "</a><br/>")
sb.Append("Company Name: " & Me.txtCompany.Value & "<br/>")
sb.Append("Phone Number: " & Me.txtPhone.Value & "<br/><br/>")
sb.Append("Subject: " & Me.txtSubject.Value & "<br/>")
sb.Append("Message: " & Me.txtMessage.Value)
'message.Body = sb.ToString()
Dim message As New MailMessage("postmaster#mydomain.com", toEmail, subject, sb.ToString())
message.IsBodyHtml = True
Try
Dim client As New SmtpClient()
client.Host = "smtp.mydomain.com"
client.Port = 25
client.Credentials = New System.Net.NetworkCredential("postmaster#mydomain.com", "password")
client.Send(message)
Catch ex As SmtpException
Me.errors.Text = ex.Message & " local host message"
Return
End Try
I tried leaving off network credentials, leaving off port, leaving off the #mydomain.com on the network credentials. Nothing works
I have a piece of code which will show a list of service areas and, then, when you select a service area it will bring back a list of departments in the second dropdown box. I have the following code:
<%# Language="VBScript"%>
<% response.Buffer = TRUE
'Defines the variables and objects
dim ADUser, RecordList, intOne, intTwo, intThree, companies, service_area, department, arrComp
'Assigns the objComp and objDept variables to Scripting Dictionary objects
%>
<!--#include file="includes/functions.asp"-->
<!--#include file="includes/display.asp"-->
<!--#include file="includes/results.asp"-->
<!--#include file="includes/timer.asp"-->
<h1>Organisational Structure</h1>
<div class="commandspace">
<p class="infotext">The org structure can be viewed with or without staff, indented or left justified.</p>
</div>
<%
ADUser = "LDAP://RBCTHDC1/OU=Staff,OU=Users,DC=example,DC=internal"
' Make AD connection and run query
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.provider ="ADsDSOObject"
objCon.Properties("User ID") = "DOMAIN\username"
objCon.Properties("Password") = "Password"
objCon.Properties("Encrypt Password") = TRUE
objCon.open "Active Directory Provider"
Set objCom = CreateObject("ADODB.Command")
Set objCom.ActiveConnection = objCon
objCom.CommandText ="select company FROM '"& ADUser &"' where company ='*'"
Set objRS = objCom.Execute 'Creates an object and runs the LDAP query
companies = objRS.GetRows()
set arrComp = Server.CreateObject("Scripting.Dictionary")
for intOne = 0 to UBound(companies,2)
if not arrComp.exists(companies(0, intOne)) then
arrComp.add companies(0, intOne), companies(0, intOne)
end if
next
response.write "<form action='index.asp?View=Structure' method='POST'>"
response.write "<select id='service_area' name='service_area' onChange='showTeams(this.value)'>"
response.write "<option>Please Select</option>"
for intTwo = 0 to arrComp.Count
response.write "<option value='"& Server.URLEncode(arrComp.Item(intTwo)) &"'>" & arrComp.Item(intTwo) & "</option>" & VBCrlF
next
response.write "</select>" & VBCrlF
response.write "<span class='structure-spacing'></span>" & VBCrlF
response.write "<select id='department' name='department'></select>" & VBCrlF
response.write "<span class='structure-spacing'></span>" & VBCrlF
response.write "<input type='submit' name='submit' id='submit'>" & VBCrlF
response.write "</form>" & VBCrlF
if request.form("submit")="Submit" then
service_area = request.form("service_area")
department = request.form("department")
if service_area = "Please Select" then
response.write "<p>Service area cannot be left empty</p>"
end if
if IsEmpty(department) then
response.write "<p>Department cannot be left empty</p>"
end if
objCom.CommandText ="select company, department, title, cn FROM '"& ADUser &"' where department = '" & department & "' ORDER BY department"
else
objCom.CommandText ="select company, department, title, cn FROM '"& ADUser &"' where company ='*' ORDER BY department"
end if
Set objRS = objCom.Execute 'Creates an object and runs the LDAP query
RecordList = objRS.GetRows()
response.write "<table>" & VBCrlF
response.write "<thead>" & VBCrlF
response.write "<tr>" & VBCrlF
response.write "<th>Service Area</th>" & VBCrlF
response.write "<th>Department</th>" & VBCrlF
response.write "<th>Job Title</th>" & VBCrlF
response.write "<th>Name</th>" & VBCrlF
response.write "</tr>" & VBCrlF
response.write "</thead>" & VBCrlF
response.write "<tbody>" & VBCrlF
for intThree = 0 to UBound(RecordList,2)
response.write "<tr>" & VBCrlF
response.write "<td>" & RecordList(3, intThree) & "</td>" & VBCrlF
response.write "<td>" & RecordList(2, intThree) & "</td>" & VBCrlF
response.write "<td>" & RecordList(1, intThree) & "</td>" & VBCrlF
response.write "<td>" & RecordList(0, intThree) & "</td>" & VBCrlF
response.write "</tr>" & VBCrlF
next
response.write "</tbody>" & VBCrlF
response.write "</table>" & VBCrlF
objRS.Close
objCon.Close
Set objCon = Nothing
Set objCom = Nothing
%>
I can't find a way of removing duplicate entries. Using a Scripting Dictionary, I am getting an empty drop down box. Instead of returning a list of service area, it doesn't return anything - just an empty option value
I have the following script in a classic asp page:
<%
Response.Write "<script language=""vbscript"">" & vbcrlf
'----------------------------------
Response.Write "sub window_onload" & vbcrlf
'Response.Write "On Error Resume Next" & vbcrlf
Response.Write " dim t1 " & vbcrlf
Response.Write " set xfile = AXFFileDownload.XFRequest " & vbcrlf
Response.Write " AXFFileDownload.AddFile ""c:\contalfinger\tester.mdb"", ""http://" & Request.servervariables("LOCAL_ADDR") & application("portinternet") & "/transfert_fichiers/FZ" & kteur & ".mdb" & chr(34) & vbcrlf
Response.Write " If Err.number <> 0 Then " & vbcrlf
Response.Write " msgbox(""You may not have SA-XFile installed."") " & vbcrlf
Response.Write " End IF " & vbcrlf
'Response.Write " call contalMSN.faireDirectory(""c:\contalfinger"") " & vbcrlf
Response.Write " t1=contalMSN.wait(2) " & vbcrlf
Response.write " AXFFileDownload.Start" & vbcrlf
'Response.Write " call contalMSN.faireCMD(""c:\tmp\fichier2.eml"") " & vbcrlf
'Response.Write " window.close() " & vbcrlf
Response.Write " window.location.href=""loginfinger.asp" & chr(34) & vbcrlf
Response.Write "end sub" & vbcrlf
Response.Write "</script>" & vbcrlf
%>
The problem is that the mdb file on the server has 336KB but when it is downloaded to the client computer it's reduce to 2KB and can't be open due to following error message: Unrecorignised database format.
This script was working before we change server.
Any help will be reallly appreciated.
Thank you
Ok I found it. I had to modify the file found in the below path:
C:\Windows\System32\inetsrv\config\applicationhost.config
<add fileExtension=".mdb" allowed="false" /> for <add fileExtension=".mdb" allowed="true" />
Im trying to call de GetVerifiedStatus API.
Im using a server with Windows 7.
Can anyone help me plz.
This is my code:
Dim objXMLHTTP : set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim strRequest, strResult, strURL
strURL = "https://svcs.paypal.com/AdaptiveAccounts/GetVerifiedStatus"
strRequest ="<?xml version=""1.0"" encoding=""utf-8""?>" _
& "<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/""" _
& " xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" _
& " <SOAP-ENV:Header>" _
& " <RequesterCredentials xmlns=""urn:ebay:api:PayPalAPI"" xsi:type=""ebl:CustomSecurityHeaderType"">" _
& " <Credentials xmlns=""urn:ebay:apis:eBLBaseComponents"" xsi:type=""ebl:UserIdPasswordType"">" _
& " <Username>XXXX</Username>" _
& " <Password>XXXX</Password>" _
& " <Signature>XXXX</Signature>" _
& " <Subject>XXXX</Subject>" _
& " </Credentials>" _
& " </RequesterCredentials>" _
& " </SOAP-ENV:Header>" _
& " <SOAP-ENV:Body>" _
& " <Version xmlns=""urn:ebay:apis:eBLBaseComponents"">98.0</Version>" _
& " <emailAddress xs:""string"">john#gmail.com</emailAddress>" _
& " <firstName xs:""string"">John</firstName>" _
& " <lastName xs:""string"">Vegas</lastName>" _
& " <matchCriteria xs:""string"">NAME</matchCriteria>" _
& " <requestEnvelope common:""RequestEnvelope"">" _
& " <detailLevel xs:""string"">ReturnAll</detailLevel>" _
& " <errorLanguage xs:""string"">en_US</errorLanguage>" _
& " </requestEnvelope>" _
& " </SOAP-ENV:Body>" _
& "</SOAP-ENV:Envelope>"
objXMLHTTP.open "post", "" & strURL & "", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.setRequestHeader "SOAPAction", strURL
objXMLHTTP.send(strRequest)
strResult = objXMLHTTP.responseText
response.write strResult
Im receiving this error:
msxml3.dll erro '800c0008'
Failed to download the specified resource
At objXMLHTTP.send(strRequest) line.
When I changed my http object to MSXML2.ServerXMLHTTP, returns a error that said:
A certified is necessary to complete the client authentication.
Tks.
You can use Call objXMLHTTP.send(strRequest) instead of objXMLHTTP.send(strRequest)
I am not sure but you can try this because i found this from Classic ASP tutorial for payment gatway.
Here is the link for that: http://jadendreamer.wordpress.com/2009/09/02/classic-asp-soap-request-code-example
I'm trying to submit my EnquiryForm using .Asp but I keep getting a server error...
Would like to send the captured form details to my email address and also confirm the details with the customer.
Any thoughts why its not working....
Updated Code:
<%#LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
'send by connecting to port 25 of the SMTP server'
Dim iMsg
Dim iConf
Dim Flds
Dim strBody
Dim strSmartHost
Const cdoSendUsingPort = 2
StrSmartHost = "smtp.glimmer-nights.co.uk"
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
set Flds = iConf.Fields
'Set the CDOSYS configuration fields to use port 25 on the SMTP server'
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
'Build Message body'
strBody = "Fullname: " & Request.form("firstname") & Request.form("Surname") & vbcrlf
strBody = strBody & "Address: " & Request.form("Address") & vbcrlf
strBody = strBody & "Postcode: " & Request.form("postcode") & vbcrlf
strBody = strBody & "Contact No: " & Request.form("tel") & vbcrlf
strBody = strBody & "Email: " & Request.form("email") & vbcrlf
strBody = strBody & "How did you hear about us: " & Request.form("where") & vbcrlf
strBody = strBody & "Function Date: " & Request.form("fday") & Request.form("fmonth") & Request.form("fyear") & vbcrlf
strBody = strBody & "Venue Name: " & Request.form("vname") & vbcrlf
strBody = strBody & "Venue Address: " & Request.form("vaddress") & vbcrlf
strBody = strBody & "Venue Postcode: " & Request.form("vpostcode") & vbcrlf
strBody = strBody & "Function Type: " & Request.form("ftype") & vbcrlf
strBody = strBody & "No. Attending: " & Request.form("noattend") & vbcrlf
strBody = strBody & "Arrive At: " & Request.form("arrive") & vbcrlf
strBody = strBody & "Guest Arrival: " & Request.form("garrival") & vbcrlf
strBody = strBody & "Function End: " & Request.form("fend") & vbcrlf
strBody = strBody & "Additional Information: " & Request.form("additionalInfoTextarea")
'Apply the settings to the message'
With iMsg
Set .Configuration = iConf
.To = "info#glimmer-nights.co.uk"
.From = "info#glimmer-nights.co.uk"
.Subject = "Online Enquiry"
.TextBody = strBody
.Send
End With
Response.Write("<h1>Booking Enquiry Sent!</h1><p>Thank you for submitting your online booking enquiry for DJ's in Telford or Dj's in Shropshire. We will contact you shortly.<p>")
'SEND EMAIL TO CUSTOMER'
'Build Message body'
strBody = "Hi " & Request.form("firstname") & " " & Request.form("surname") & "," & vbcrlf & vbcrlf
strBody = strBody & "We have your contact details as follows: " & vbcrlf & vbcrlf
strBody = strBody & "Fullname: " & Request.form("firstname") & Request.form("Surname") & vbcrlf
strBody = strBody & "Contact No: " & Request.form("tel") & vbcrlf
strBody = strBody & "Email: " & Request.form("email") & vbcrlf
strBody = strBody & "Address: " & Request.form("Address") & vbcrlf
strBody = strBody & "Postcode: " & Request.form("postcode") & vbcrlf
strBody = strBody & "Your function details are as follows: " & vbcrlf & vbcrlf
strBody = strBody & "Function Date: " & Request.form("fday") & Request.form("fmonth") & Request.form("fyear") & vbcrlf
strBody = strBody & "Venue Name: " & Request.form("vname") & vbcrlf
strBody = strBody & "Venue Address: " & Request.form("vaddress") & vbcrlf
strBody = strBody & "Venue Postcode: " & Request.form("vpostcode") & vbcrlf
strBody = strBody & "Function Type: " & Request.form("ftype") & vbcrlf
strBody = strBody & "No. Attending: " & Request.form("noattend") & vbcrlf
strBody = strBody & "Guest Arrival: " & Request.form("garrival") & vbcrlf
strBody = strBody & "Function End: " & Request.form("fend") & vbcrlf
strBody = strBody & "Additional Information: " & Request.form("additionalInfoTextarea") & vbcrlf
strBody = strBody & "Your quotation will be based on the information provided above." & vbcrlf & vbcrlf
strBody = strBody & "Thank you for your online booking enquiry. We will be in contact with you shortly to confirm availability & prices." & vbcrlf & vbcrlf
strBody = strBody & "We look forward to speaking to you soon." & vbcrlf & vbcrlf
strBody = strBody & "DJ Glimmer" & vbcrlf
strBody = strBody & "Glimmer Nights Entertainment" & vbcrlf
strBody = strBody & "T: 01952 247207" & vbcrlf
strBody = strBody & "M: 07772 471449" & vbcrlf & vbcrlf
'Apply the settings to the message'
With iMsg
Set .Configuration = iConf
.To = Request.form("email")
.From = "info#glimmer-nights.co.uk"
.Subject = "Your Entertainment Booking Enquiry"
.TextBody = strBody
.Send
End With
Then
'Enquiry Sent - redirect to Home page'
Response.Redirect("http://www.glimmer-nights.co.uk/index.html")
End
'Cleanup of variables'
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
</body>
</html>
You have syntax error. There is this block of code:
Then
'Enquiry Sent - redirect to Home page'
Response.Redirect("http://www.glimmer-nights.co.uk/index.html")
End
It's wrong, probably left my mistake by the programmer who wrote the code for you. It should be just:
'Enquiry Sent - redirect to Home page'
Response.Redirect("http://www.glimmer-nights.co.uk/index.html")
If still no luck please post full error message and what line is causing it.