Solved

Multi-line bodies using asp.net and mailmessage

Posted on 2009-07-02
2
522 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

776 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