Solved

Multi-line bodies using asp.net and mailmessage

Posted on 2009-07-02
2
526 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 500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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