Solved

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

Posted on 2006-11-27
17
421 Views
Last Modified: 2009-12-16
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
Comment
Question by:jblayney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
17 Comments
 
LVL 22

Expert Comment

by:WMIF
ID: 18022518
is this going to an internal server or external server?
0
 
LVL 1

Author Comment

by:jblayney
ID: 18023099
external, an asp web form externally hosted.
0
 
LVL 22

Expert Comment

by:WMIF
ID: 18023436
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:jblayney
ID: 18023537
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
 
LVL 22

Expert Comment

by:WMIF
ID: 18023614
>>.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
 
LVL 1

Author Comment

by:jblayney
ID: 18023667
i assume local
0
 
LVL 1

Author Comment

by:jblayney
ID: 18023779
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
 
LVL 22

Expert Comment

by:WMIF
ID: 18023815
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
 
LVL 1

Author Comment

by:jblayney
ID: 18024018
yes, it is a shared server...  My initial thought was that it was a server RAM issue.
0
 
LVL 22

Expert Comment

by:WMIF
ID: 18024126
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
 
LVL 1

Author Comment

by:jblayney
ID: 18028872
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
 
LVL 22

Expert Comment

by:WMIF
ID: 18030144
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
 
LVL 1

Author Comment

by:jblayney
ID: 18037745
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
 
LVL 22

Accepted Solution

by:
WMIF earned 50 total points
ID: 18040861
>>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
 
LVL 22

Expert Comment

by:WMIF
ID: 18040901
>>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
 
LVL 1

Author Comment

by:jblayney
ID: 18044983
"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
 
LVL 22

Expert Comment

by:WMIF
ID: 18047008
that might be a question to ask in the mac topic area to see if anyone else has had problems like this.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question