asp.net 1.1 mailmessage
-
I have created a form that collects some information then builds that information using a stringbuilder into an html table and finally sends that to a sales desk via system.web.mail everything works as expected except the html portion of the recieved email has been truncated to 1022 characters. The plain text portion of the recieved email contains all of the information. I have looked all over msdn for any indication of size limitations or max size properties and found nothing. Does anyone have any idea what might be causeing this to happen. End of Line.
-
I have created a form that collects some information then builds that information using a stringbuilder into an html table and finally sends that to a sales desk via system.web.mail everything works as expected except the html portion of the recieved email has been truncated to 1022 characters. The plain text portion of the recieved email contains all of the information. I have looked all over msdn for any indication of size limitations or max size properties and found nothing. Does anyone have any idea what might be causeing this to happen. End of Line.
-
Can you please show your code. Let me look at it and get back to you. In my previous application I did the same way, it works. Regards, Shiby
Here's the code as requested:
Private Sub SendEmail(mailTo) Dim MsgTxt as StringBuilder = New StringBuilder() MsgTxt.EnsureCapacity(1500) MsgTxt.append("Purchaser Information Form TURBO mail ========== ") MsgTxt.append(" ### Purchaser Information Form ") MsgTxt.append(" Source ") MsgTxt.append(Textbox1.text) MsgTxt.append(" Property Ref. No. ") MsgTxt.append(Textbox2.text) MsgTxt.append(" Family Name ") MsgTxt.append(Textbox3.text) MsgTxt.append(" Fore Name ") MsgTxt.append(Textbox4.text) MsgTxt.append(" Wife's Maiden Name ") MsgTxt.append(Textbox5.text) MsgTxt.append(" Wife's Fore Name ") MsgTxt.append(Textbox6.text) MsgTxt.append(" Postal Address ") MsgTxt.append(Textbox7.text) MsgTxt.append(" Town/City ") MsgTxt.append(Textbox8.text) MsgTxt.append(" County/Region ") MsgTxt.append(Textbox9.text) MsgTxt.append(" Country ") MsgTxt.append(Textbox10.text) MsgTxt.append(" Post Code ") MsgTxt.append(Textbox11.text) MsgTxt.append(" ") MsgTxt.append(" Home Telephone ") MsgTxt.append(Textbox12.text) MsgTxt.append(" Work Telephone ") MsgTxt.append(Textbox13.text) MsgTxt.append(" Mobile Telephone ") MsgTxt.append(Textbox14.text) MsgTxt.append(" Email Address ") MsgTxt.append(Textbox15.text) MsgTxt.append(" Occupation ") MsgTxt.append(Textbox16.text) MsgTxt.append(" Occupation (Spouse) ") MsgTxt.append(Textbox17.text) MsgTxt.append(" Date of Birth ") MsgTxt.append(Textbox18.text) MsgTxt.append(" Date of Birth (Spouse) ") MsgTxt.append(Textbox19.text) MsgTxt.append(" Place of Birth ") MsgTxt.append(Textbox20.text) MsgTxt.append(" Place of Birth (Spouse ") MsgTxt.append(Textbox21.text) MsgTxt.append(" Married Where ") MsgTxt.append(Textbox22.text) MsgTxt.append(" Married When ") MsgTxt.append(Textbox23.text
-
Here's the code as requested:
Private Sub SendEmail(mailTo) Dim MsgTxt as StringBuilder = New StringBuilder() MsgTxt.EnsureCapacity(1500) MsgTxt.append("Purchaser Information Form TURBO mail ========== ") MsgTxt.append(" ### Purchaser Information Form ") MsgTxt.append(" Source ") MsgTxt.append(Textbox1.text) MsgTxt.append(" Property Ref. No. ") MsgTxt.append(Textbox2.text) MsgTxt.append(" Family Name ") MsgTxt.append(Textbox3.text) MsgTxt.append(" Fore Name ") MsgTxt.append(Textbox4.text) MsgTxt.append(" Wife's Maiden Name ") MsgTxt.append(Textbox5.text) MsgTxt.append(" Wife's Fore Name ") MsgTxt.append(Textbox6.text) MsgTxt.append(" Postal Address ") MsgTxt.append(Textbox7.text) MsgTxt.append(" Town/City ") MsgTxt.append(Textbox8.text) MsgTxt.append(" County/Region ") MsgTxt.append(Textbox9.text) MsgTxt.append(" Country ") MsgTxt.append(Textbox10.text) MsgTxt.append(" Post Code ") MsgTxt.append(Textbox11.text) MsgTxt.append(" ") MsgTxt.append(" Home Telephone ") MsgTxt.append(Textbox12.text) MsgTxt.append(" Work Telephone ") MsgTxt.append(Textbox13.text) MsgTxt.append(" Mobile Telephone ") MsgTxt.append(Textbox14.text) MsgTxt.append(" Email Address ") MsgTxt.append(Textbox15.text) MsgTxt.append(" Occupation ") MsgTxt.append(Textbox16.text) MsgTxt.append(" Occupation (Spouse) ") MsgTxt.append(Textbox17.text) MsgTxt.append(" Date of Birth ") MsgTxt.append(Textbox18.text) MsgTxt.append(" Date of Birth (Spouse) ") MsgTxt.append(Textbox19.text) MsgTxt.append(" Place of Birth ") MsgTxt.append(Textbox20.text) MsgTxt.append(" Place of Birth (Spouse ") MsgTxt.append(Textbox21.text) MsgTxt.append(" Married Where ") MsgTxt.append(Textbox22.text) MsgTxt.append(" Married When ") MsgTxt.append(Textbox23.text
so most definitly use the html text writer. it will be more organized Create subroutines to handle the small tasks and it wont be so hard. For instance, your checkbox rows call a subroutine like so CreateCheckBoxRow( string ID, string text, book checked) { ... } this code creates a table with a cellspacing attribute System.IO.StreamWriter sw = new System.IO.StreamWriter(@"C:\Table.txt"); System.Web.UI.HtmlTextWriter ht = new System.Web.UI.HtmlTextWriter( sw ); ht.WriteBeginTag("TABLE"); ht.WriteAttribute("cellspacing", "2", true); ht.Write(System.Web.UI.HtmlTextWriter.TagRightChar); ht.WriteFullBeginTag("TR"); ht.WriteBeginTag("TD"); ht.Write(System.Web.UI.HtmlTextWriter.TagRightChar); ht.WriteEndTag("TD"); ht.WriteEndTag("TR"); ht.WriteEndTag("TABLE"); ht.Close(); 1 line of code equals many bugs. So don't write any!!
-
Here's the code as requested:
Private Sub SendEmail(mailTo) Dim MsgTxt as StringBuilder = New StringBuilder() MsgTxt.EnsureCapacity(1500) MsgTxt.append("Purchaser Information Form TURBO mail ========== ") MsgTxt.append(" ### Purchaser Information Form ") MsgTxt.append(" Source ") MsgTxt.append(Textbox1.text) MsgTxt.append(" Property Ref. No. ") MsgTxt.append(Textbox2.text) MsgTxt.append(" Family Name ") MsgTxt.append(Textbox3.text) MsgTxt.append(" Fore Name ") MsgTxt.append(Textbox4.text) MsgTxt.append(" Wife's Maiden Name ") MsgTxt.append(Textbox5.text) MsgTxt.append(" Wife's Fore Name ") MsgTxt.append(Textbox6.text) MsgTxt.append(" Postal Address ") MsgTxt.append(Textbox7.text) MsgTxt.append(" Town/City ") MsgTxt.append(Textbox8.text) MsgTxt.append(" County/Region ") MsgTxt.append(Textbox9.text) MsgTxt.append(" Country ") MsgTxt.append(Textbox10.text) MsgTxt.append(" Post Code ") MsgTxt.append(Textbox11.text) MsgTxt.append(" ") MsgTxt.append(" Home Telephone ") MsgTxt.append(Textbox12.text) MsgTxt.append(" Work Telephone ") MsgTxt.append(Textbox13.text) MsgTxt.append(" Mobile Telephone ") MsgTxt.append(Textbox14.text) MsgTxt.append(" Email Address ") MsgTxt.append(Textbox15.text) MsgTxt.append(" Occupation ") MsgTxt.append(Textbox16.text) MsgTxt.append(" Occupation (Spouse) ") MsgTxt.append(Textbox17.text) MsgTxt.append(" Date of Birth ") MsgTxt.append(Textbox18.text) MsgTxt.append(" Date of Birth (Spouse) ") MsgTxt.append(Textbox19.text) MsgTxt.append(" Place of Birth ") MsgTxt.append(Textbox20.text) MsgTxt.append(" Place of Birth (Spouse ") MsgTxt.append(Textbox21.text) MsgTxt.append(" Married Where ") MsgTxt.append(Textbox22.text) MsgTxt.append(" Married When ") MsgTxt.append(Textbox23.text
When you are creating an object of StringBuilder, please don't need to specify following statement MsgTxt.EnsureCapacity(1500) Remove this statement "MsgTxt.EnsureCapacity(1500)" and try out, it will work. :) Please do let me know if you are facing any problem. Regards, Shiby
-
I have created a form that collects some information then builds that information using a stringbuilder into an html table and finally sends that to a sales desk via system.web.mail everything works as expected except the html portion of the recieved email has been truncated to 1022 characters. The plain text portion of the recieved email contains all of the information. I have looked all over msdn for any indication of size limitations or max size properties and found nothing. Does anyone have any idea what might be causeing this to happen. End of Line.
Shiby you're talking nonsense, there is nothing wrong with the content of the stringbuilder, it contains all the information. Ista your point may or may not be valid, but it still doesn't explain why the resultant email only contains the first 1022 characters of the html message portion and the entire message in the plain text portion. End of Line.