?
Solved

Multi-line bodies using asp.net and mailmessage

Posted on 2009-07-02
2
Medium Priority
?
542 Views
Last Modified: 2012-05-07
I'm having web visitors fill out a form, and then want to email the data from that form to someone else.    My problem is that I can only make the body so long before the message doesn't get sent.  I'm figuring there must be some sort of string size limit to the body.  Can anyone tell me how I can load a large amount of text on the body
Dim eMessage As New MailMessage()
        eMessage.From = New System.Net.Mail.MailAddress(TextBoxEmail.Text)
        eMessage.To.Add(New System.Net.Mail.MailAddress("randy@tradewinds-software.com"))
        eMessage.Subject = "Lava Lava Registration Form"
        eMessage.Body = "Name: " + TextBoxName.Text + Chr(13) + "Address: " + TextBoxAddress.Text + Chr(13) + "City:" + TextBoxCity.Text + Chr(13) + "State:" + TextBoxState.Text + Chr(13) + "Zip:" + TextBoxZip.Text + Chr(13) + "Home Telephone:" + TextBoxHomeTelephone.Text + Chr(13) + "Email:" + TextBoxEmail.Text + Chr(13) + "Date of Birth:" + TextBoxDateOfBirth.Text + Chr(13) + "Age:" + TextBoxAge.Text + Chr(13) + "Last Grade Completed:" + TextBoxLastGradeCompleted.Text + Chr(13) + "Emergency Contact:" + TextBoxEmergencyContact.Text + Chr(13) + "Mother:" + TextBoxMother.Text + Chr(13) + "Father:" + TextBoxFather.Text + Chr(13) + "Other:" + TextBoxOther.Text + Chr(13) + "Allergies and Medical Conditions:" + TextBoxAllergies.Text + Chr(13) + "Home Church:" + TextBoxHomeChurch.Text + Chr(13) + "Name of Special Friend:" + TextBoxNameOfFriend.Text + Chr(13)

Open in new window

0
Comment
Question by:Randy Rich
[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
2 Comments
 
LVL 3

Accepted Solution

by:
dipakdave1983 earned 2000 total points
ID: 24770147
there is newline contant for c#   if your email type is "plain"
 Environment.NewLine


if you are specifying mail type = html then u have to use "<br>" in the message for new line...
0
 

Author Comment

by:Randy Rich
ID: 24772555
That still doesn't work.  It only works if I send a portion of it.
 

Here's the code that doesn't work
 
 
eMessage.IsBodyHtml = True 
eMessage.Body = "Name: " + TextBoxName.Text + "<br>" + "Address: " + TextBoxAddress.Text + "<br>" + "City:" + TextBoxCity.Text + "<br>" + "State:" + TextBoxState.Text + "<br>" + "Zip:" + TextBoxZip.Text + "<br>" + "Home Telephone:" + TextBoxHomeTelephone.Text + "<br>" + "Email:" + TextBoxEmail.Text + "<br>" + "Date of Birth:" + TextBoxDateOfBirth.Text + "<br>" + "Age:" + TextBoxAge.Text + "<br>" + "Last Grade Completed:" + TextBoxLastGradeCompleted.Text + "<br>" + "Emergency Contact:" + TextBoxEmergencyContact.Text + "<br>" + "Mother:" + TextBoxMother.Text + "<br>" + "Father:" + TextBoxFather.Text + "<br>" + "Other:" + TextBoxOther.Text + "<br>" + "Allergies and Medical Conditions:" + TextBoxAllergies.Text + "<br>" + "Home Church:" + TextBoxHomeChurch.Text + "<br>" + "Name of Special Friend:" + TextBoxNameOfFriend.Text + "<br>" 
 
Here's the code that does work, but doesn't contain everything I want to send
 
 eMessage.IsBodyHtml = True 
eMessage.Body = "Name: " + TextBoxName.Text + "<br>" + "Address: " + TextBoxAddress.Text 

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

801 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