Solved

Multi-line bodies using asp.net and mailmessage

Posted on 2009-07-02
2
520 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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now