Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

large email message. sometimes get server error, other times - dont

hello,

I have built a very large email form... now when I send identical form information sometimes it works.....

 other times i get this error

error '80040211'
/apply_mail.asp, line 30

or this error

CDO.Message.1 error '80040213' The transport failed to connect to the server.

why does it work 50% of the time, the other times i get this error?
0
jblayney
Asked:
jblayney
  • 9
  • 8
1 Solution
 
WMIFCommented:
is this going to an internal server or external server?
0
 
jblayneyAuthor Commented:
external, an asp web form externally hosted.
0
 
WMIFCommented:
im sorry, i meant to ask if the form was being submitted to an external or internal smtp server.  are you using the webserver's smtp server or are you pointing to another server for delivery?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
jblayneyAuthor Commented:
Im not exactly sure, I think I am using the servers smtp... here is a bit of the code


<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows Library" -->

<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
<%
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds

Const cdoSendUsingPort = 2

Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")

Set Flds = iConf.Fields
With Flds
            .Item(cdoSendUsingMethod) = cdoSendUsingPort
            .Item(cdoSMTPServer) = "mail-fwd"
            .Item(cdoSMTPServerPort) = 25
            .Item(cdoSMTPconnectiontimeout) = 10
            .Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

Dim ...( about 70 fields)


firstName_req = Trim(Server.HTMLEncode(Request.form("firstName_req")))
lastName_req = Trim(Server.HTMLEncode(Request.form("lastName_req")))
grade_req_numeric = Trim(Server.HTMLEncode(Request.form("grade_req_numeric")))
address_req = Trim(Server.HTMLEncode(Request.form("address_req")))
city_req = Trim(Server.HTMLEncode(Request.form("city_req")))
state_req = Trim(Server.HTMLEncode(Request.form("state_req")))
zipcode = Trim(Server.HTMLEncode(Request.form("zipcode")))
country_req = Trim(Server.HTMLEncode(Request.form("country_req")))
(about 60 more)


END SUB



fromWho = Trim(Server.HTMLEncode(Request.form("email_email")))
toWho = "me@mywebsite.net"
Subject = "******** Online Application ********"

Body = " ******** Online Application ********" &_
                  vbcrlf & vbcrlf &_
                         
                          "first name: " & Trim(Server.HTMLEncode(Request.form("firstName_req")))  &_
                          vbcrlf &_
                  "last name: " & Trim(Server.HTMLEncode(Request.form("lastName_req")))  &_
                          vbcrlf &_
                          "grade: " & Trim(Server.HTMLEncode(Request.form("grade_req_numeric")))  &_
                          vbcrlf &_
                          "Address: " & Trim(Server.HTMLEncode(Request.form("address_req")))  &_
                           vbcrlf &_
                         

 (about 70 fields are sent in this email body)                                                                                                        
                          date


If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body


'Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
' Response.redirect "tech-support-cdo-form.asp"
' Any existing page can be used for the response redirect method
END IF
%>




0
 
WMIFCommented:
>>.Item(cdoSMTPServer) = "mail-fwd"

this is the server that you are using to do the delivery.  is that the local server or another one?
0
 
jblayneyAuthor Commented:
i assume local
0
 
jblayneyAuthor Commented:
to clarify, i am not the system administrator, I have no idea how they run their servers. I just wrote the asp code...

I dont send the form to another server to process, it happens on the server the code is on
0
 
WMIFCommented:
im thinking that the smtp server is busy while you are trying to connect.  is this a shared server?  have you contacted the system administrator to find out if they are having any issues?
0
 
jblayneyAuthor Commented:
yes, it is a shared server...  My initial thought was that it was a server RAM issue.
0
 
WMIFCommented:
it could be ram, but it could also just be that another site on that server is sending a lot of emails as well.  try contacting the sys admin.
0
 
jblayneyAuthor Commented:
Hello,

Ok, to change this a bit, how can I validate this code so that if the email fails or it doens't connect to server that the user gets my error message instead of the default server message

i tried this at the bottom but it doesnt work

If objCDO.Send <> "" then
response.write "We are having Technical Difficulties, please try again later or give us a call"
end if

(sorry if this seems noobish, i have been using php for years now and forgot all my asp)
0
 
WMIFCommented:
dont worry about being noobish.  thats what we are here for. :)

i would do some error trapping like this:

on error resume next      'basically ignores errors and moves onto the next line
objCDO.Send
if err.number <> 0 then    'check the error object to see if any were raised.  0 indicates no error
  'we got an error.  do what you wish
end if
on error goto 0      'negate the "resume next" line to go back into the normal error handling.
0
 
jblayneyAuthor Commented:
Hello,


Thanks for the help, my error handling is a bit off... I get both messages, see my code below... also, I found out the issue is not my code, it is my macintosh/safari, when I send the form on a pc, I get no errors, i was able to send 27 in a row on a pc :(

on error resume next      'basically ignores errors and moves onto the next line
objCDO.Send
if err.number <> 0 then    'check the error object to see if any were raised.  0 indicates no error
response.write "<p align='center'><font color='#000000' size='2' face='Arial, Helvetica, sans-serif'><br><br>Thank you for your interest in ACA,<br><br>We will contact you during the next business day<br><br>If you would like to apply again for someone else<br><br>Please click <a href='apply.htm' target='_self'>here</a></font></p>"
end if

if err.number > 0 then    'check the error object to see if any were raised.  0 indicates no error
response.write "<p align='center'><font color='#000000' size='2' face='Arial, Helvetica, sans-serif'><br><br>We are having Technical Difficulties, please try again later or give us a call</font></p>"
end if
0
 
WMIFCommented:
>>if err.number <> 0 then
>>if err.number > 0 then

both of those if statements will run if the error number is not zero.  you need to use an if with an else statement to handle this.

if err.number <> 0 then    'check the error object to see if any were raised.  0 indicates no error
  response.write "<p align='center'><font color='#000000' size='2' face='Arial, Helvetica, sans-serif'><br><br>We are having Technical Difficulties, please try again later or give us a call</font></p>"
else
  response.write "<p align='center'><font color='#000000' size='2' face='Arial, Helvetica, sans-serif'><br><br>Thank you for your interest in ACA,<br><br>We will contact you during the next business day<br><br>If you would like to apply again for someone else<br><br>Please click <a href='apply.htm' target='_self'>here</a></font></p>"
end if
0
 
WMIFCommented:
>>also, I found out the issue is not my code, it is my macintosh/safari, when I send the form on a pc, I get no errors,

this is very strange because the client's browser should not affect anything that the server does.  the client is only submitting information to the server.  did you try running the mac and pc at the same time?
0
 
jblayneyAuthor Commented:
"this is very strange because the client's browser should not affect anything that the server does.  the client is only submitting information to the server.  did you try running the mac and pc at the same time?"

I know this is strange... Since I bought my new mac, I have noticed on a few asp websites I built that I get this problem... Im not sure what to say, it is just my conclusion from the evidence...

as a matter of fact when we were testing it yesterday (myself and someone on a pc) we were doing it at the same time... he sent 27 in a row and i get errors 3 out of 4 times....

If I switch to IE on my mac, I dont get the errors anymore

justin
0
 
WMIFCommented:
that might be a question to ask in the mac topic area to see if anyone else has had problems like this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now