I have an ASP script to email my forms with the values placed in a template html.
However I'm getting this error when sending:
error '80040211'
/sendmail_cdo.asp, line 105
(on line 105: msg.send)
I have done some research on this and a solution would be to set
msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
to:
msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
This worked great with the same script for another website, that is hosted on the same host GoDaddy (nicked: Go$hitty for their terrible support!), with the same hostin plan and settings.
However, on this site I now get the error:
CDO.Message.1 error '80040222'
The pickup directory path is required and was not specified.
/sendmail_cdo.asp, line 105
I have called the hosting company, but they're not willing to share the smtpserverpickupdirectory settings. Else I could have used the line:
msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\intepub\mailroot\Pickup\" (Or whatever this would be at GoDaddy.com)
Does anyone have any idea how I can get this script to work and perhaps tell me why it's working on 1 website, but not the other, while both have the same hosting plans / settings?
The script:
Code:<% option explicit dim pde : set pde = createobject("scripting.dictionary") pde.add "%email%", "info@mydomain.com" function getTextFromFile(path) dim fso, f, txt set fso = createobject("Scripting.FileSystemObject") if not fso.fileexists(path) then getTextFromFile = "" exit function end if set f = fso.opentextfile(path,1) if f.atendofstream then txt = "" else txt = f.readall f.close set f = nothing set fso = nothing getTextFromFile = txt end function dim redir, mailto, email, subject, item, body, cc, bcc, message, html, template, usetemplate, testmode redir = request.form("redirect") mailto = request.form("mailto") if pde.exists(mailto) then mailto = pde(mailto) cc = request.form("cc") bcc = request.form("bcc") email = request.form("email") if email = "" then email = pde("%email%") subject = request.form("subject") message = request.form("message") template = request.form("template") testmode = lcase(request.form("testmode"))="no" if len(template) > 0 then template = getTextFromFile(server.mappath(template)) if len(template) > 0 then usetemplate = true else usetemplate = false dim msg : set msg = server.createobject("CDO.Message") msg.subject = subject msg.to = mailto msg.from = email msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay-hosting.secureserver.net" msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =1 msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "email_login" msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passw" msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False msg.Configuration.Fields.Update if len(cc) > 0 then msg.cc = cc if len(bcc) > 0 then msg.bcc = bcc if not usetemplate then body = body & message & vbcrlf & vbcrlf else body = template end if for each item in request.form select case item case "redirect", "mailto", "cc", "bcc", "subject", "message", "template", "html", "testmode" case else if not usetemplate then if item <> "email" then body = body & item & ": " & request.form(item) & vbcrlf & vbcrlf else body = replace(body, "[$" & item & "$]", replace(request.form(item),vbcrlf,"<br />")) end if end select next if usetemplate then 'remove any leftover placeholders dim rx : set rx = new regexp rx.pattern = "\[\$.*\$\]" rx.global = true body = rx.replace(body, "") end if if usetemplate and lcase(request.form("html")) = "yes" then msg.htmlbody = body else msg.textbody = body end if if testmode then if lcase(request.form("html")) = "yes" then response.write "<pre>" & vbcrlf response.write "Mail to: " & mailto & vbcrlf response.write "Mail from: " & email & vbcrlf if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf response.write "Subject: " & subject & vbcrlf & string(80,"-") & "</pre>" response.write body else response.write "<html><head><title>Sendmail.asp Test Mode</title></head><body><pre>" & vbcrlf response.write "Mail to: " & mailto & vbcrlf response.write "Mail from: " & email & vbcrlf if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf response.write "Subject: " & subject & vbcrlf & vbcrlf response.write string(80,"-") & vbcrlf & vbcrlf & "<span style=""color:blue;"">" response.write body & "</span>" & vbcrlf & vbcrlf response.write string(80,"-") & vbcrlf & "**END OF EMAIL**</pre></body></html>" end if else msg.send response.redirect redir end if set msg = nothing %>



Reply With Quote
Bookmarks