Solved

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

Posted on 2006-11-27
17
404 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
  • 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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/…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now