using cdosys.asp for form mail

Discussion in 'ASP .Net Web Controls' started by Steve, Apr 26, 2007.

  1. Steve

    Steve Guest

    Hi

    I'm using a web form to enable people to submit stories to my website, but
    there appears to be issue with longer texts. When the content of the 'Story
    Text' box exceeds a certain length the form doesn't submit and an error page
    appears.

    I've pasted the relevant code here. Can any one suggest what is wrong and
    what can be done to fix.

    TIA

    Steve

    #####################################

    form page html

    <form action="cdosyssub.asp" onSubmit="" name="Story Submission">
    <font color="#FFFFFF"> <font size="3" face="Arial, Helvetica,
    sans-serif">
    Full Name</font><br>
    <input type="text" size="35" maxlength="30" name="RealName"
    value="">
    <br>
    Pen name</font><br>
    <font size="1" face="Arial, Helvetica, sans-serif"
    color="#FFFFFF">(name
    you want story published under)</font><font size="3"
    face="Arial, Helvetica, sans-serif" color="#FFFFFF"><br>
    <input type="text" size="35" maxlength="30" name="PenName"
    value="">
    <br>
    <font size="3" face="Arial, Helvetica, sans-serif">Your E-mail
    address<br>
    <font size="1">(this must be completed in case of queries)<br>
    <input type="text" size="35" name="Email" value="">
    </font><br>
    <br>
    <input type="hidden" size="35" maxlength="30" name="Subject"
    value="Story Submission">
    <br>
    I confirm that the story below is either my own work, or it is
    submitted
    with the approval of the author and that all copyright is
    correctly
    attributed. I understand that by submitting this form I am
    consenting
    to its inclusion on www.mydomain.co.uk.</font>
    <p> <font size="3" face="Arial, Helvetica, sans-serif"
    color="#FFFFFF">
    <input type="checkbox" name="Confirmation" value="Yes, I
    agree to publication">
    <font size="2">(Click to agree)</font></font>
    <p><font size="3" face="Arial, Helvetica, sans-serif"
    color="#FFFFFF">Story
    Title </font><font color="#FFFFFF"><br>
    </font><font size="3" face="Arial, Helvetica, sans-serif"
    color="#FFFFFF">
    <input type="text" size="35" maxlength="30"
    name="StoryTitle" value="">
    </font><font color="#FFFFFF"> <br>
    <textarea name="StoryText" rows="10" cols="75">Please paste
    a plain text version of your story here</textarea>
    <br>
    <input type="submit" name ="SUBMIT" value="SUBMIT" >
    </font>
    </font>
    </form>

    ################################################
    cdosys.asp

    {the following sits in front of the html tags for that file}

    <%
    dim HTML,RealName,PenName,Email,Subject,Confirmation,StoryTitle,StoryText
    HTML = HTML & " <html><body>"
    HTML = HTML & " <table border=""0"">"
    HTML = HTML & " <tr>"
    HTML = HTML & " <th bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2""> <b>Your Name: </b> </font> </p>"
    HTML = HTML & " </th>"
    HTML = HTML & " <td bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2"">" & Request("RealName") & "</p>"
    HTML = HTML & " </td>"
    HTML = HTML & " </tr>"
    HTML = HTML & " <tr>"
    HTML = HTML & " <th bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2""> <b>Pen Name: </b> </font> </p>"
    HTML = HTML & " </th>"
    HTML = HTML & " <td bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2"">" & Request("PenName") & "</p>"
    HTML = HTML & " </td>"
    HTML = HTML & " </tr>"
    HTML = HTML & " <tr>"
    HTML = HTML & " <th bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2""> <b>Your Email Address: </b> </font> </p>"
    HTML = HTML & " </th>"
    HTML = HTML & " <td bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2"">" & Request("Email") & "</p>"
    HTML = HTML & " </td>"
    HTML = HTML & " </tr>"
    HTML = HTML & " <tr>"
    HTML = HTML & " <th bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2""> <b>Subject: </b> </font> </p>"
    HTML = HTML & " </th>"
    HTML = HTML & " <td bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2"">" & Request("Subject") & "</p>"
    HTML = HTML & " </td>"
    HTML = HTML & " </tr>"
    HTML = HTML & " <tr>"
    HTML = HTML & " <th bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2""> <b>Agreement to Publication: </b> </font>
    </p>"
    HTML = HTML & " </th>"
    HTML = HTML & " <td bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2"">" & Request("Confirmation") & "</p>"
    HTML = HTML & " </td>"
    HTML = HTML & " </tr>"
    HTML = HTML & " <tr>"
    HTML = HTML & " <th bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2""> <b>Story Title: </b> </font> </p>"
    HTML = HTML & " </th>"
    HTML = HTML & " <td bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2"">" & Request("StoryTitle") & "</p>"
    HTML = HTML & " </td>"
    HTML = HTML & " </tr>"
    HTML = HTML & " <tr>"
    HTML = HTML & " <th colspan=""2"" bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2""> <b>Story Text: </b> </font> </p>"
    HTML = HTML & " </th>"
    HTML = HTML & " </tr>"
    HTML = HTML & " <tr>"
    HTML = HTML & " <td colspan=""2"" bgcolor=""#B0CDDD"">"
    HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left"">
    <font face=""arial"" size=""2"">" & Request("StoryText") & "</p>"
    HTML = HTML & " </td>"
    HTML = HTML & " </tr>"
    HTML = HTML & " </table>"
    HTML = HTML & "<br>"
    HTML = HTML & " </body></html>"

    'CDOSYS Configuration
    Set oMail = Server.CreateObject("CDO.Message")
    Set iConf = Server.CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields

    'Default parameters for Dataflame (dont change)
    iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")
    = 2
    iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    = "localhost"
    'Note
    'Use "localhost" If mail is routed from same server.
    'Use Server IP like "203.90.78.221" if Domain has MX record having IP
    "203.90.78.221" OR Mails are routed from that IP

    iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
    = 10
    iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
    = 25
    iConf.Fields.Update
    Set oMail.Configuration = iConf
    oMail.To = ""
    oMail.From = ""
    oMail.Subject = "Story Submission"

    'If message body is in HTML FORMAT
    oMail.BodyPart.ContentTransferEncoding = "quoted-printable"
    oMail.HTMLBody = HTML
    oMail.Send
    Set iConf = Nothing
    Set Flds = Nothing
    %>
     
    Steve, Apr 26, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. martin

    cdosys.dll and sending mail

    martin, Jul 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,215
    wolfgangiron
    Jan 4, 2012
  2. Steve Y.

    CDOSYS.dll System.Web.Mail

    Steve Y., Sep 3, 2003, in forum: ASP .Net Security
    Replies:
    8
    Views:
    223
  3. Serge Myrand

    Problem sending mail (CDOSYS)

    Serge Myrand, Aug 9, 2004, in forum: ASP General
    Replies:
    2
    Views:
    326
    Serge Myrand
    Aug 9, 2004
  4. Replies:
    4
    Views:
    309
  5. mister-Ed

    CDOsys asp mail script problems

    mister-Ed, Sep 21, 2007, in forum: ASP General
    Replies:
    2
    Views:
    249
    Anthony Jones
    Sep 21, 2007
Loading...

Share This Page