473,778 Members | 4,256 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.web.mail truncating message body - strange behaviour ??

Hi,

I am running Windows 2003/ IIS 6.0. I was stuck with rather a abnormal
behaviour of System.Web.mail class. It was truncating the message body
after 3,071 character. The code i was testing was:

Import Namespace="Syst em.Web.Mail"
Dim aa as new StringBuilder(6 00010)
Dim i as Integer

For i = 1 to 60000
aa = aa.Append("a")
next

aa = aa.Append("end" )
Dim objMailMessage As New MailMessage
objMailMessage = New MailMessage
'send mail
TRY
With objMailMessage
.To = "ab*@myDomain.c om"
.From = "su*****@myDoma in.info"
.Subject = "Test Webmail"
.BodyFormat = MailFormat.Text
.Body = len(aa.Tostring ()) & "--" & aa.Tostring()
End With

SmtpMail.Send(o bjMailMessage)
CATCH
response.write (err.descriptio n)
END TRY

response.write ("<br><br>" & aa.Tostring() & "<br>end<br >")

I modified the settings of IIS SMPT and removed all the constraints. I
also checked with my incoming POP server. I checked with Classic ASP
and everything work fine.

I even tried setting the BodyEncoding property of the mailMessage
object to different options but to no avail.

I just inserted CHR(10) at the position where it was truncating and IT
WORKED.

I still could not figure out the logical reason behind it. Anyone here
could throw some light on it ??

Regards.
Jitesh Sinha
Nov 18 '05 #1
1 2521
I've had a similar problem with textboxes on windows forms, using the
AppendText method. Text would get truncated after 3000 something
characters. I managed to get around this by appending the Text property -
i.e. using textBox1.Text += "Some Text" as opposed to
textBox1.Append Text("Some Text"). It's a less efficient way to do things,
but it stopped the strings from being truncated.

It appears that the StringBuilder class has a similar problem...

Mun


"Jitesh Sinha" <ji****@getwebd omains.com> wrote in message
news:ae******** *************** ***@posting.goo gle.com...
Hi,

I am running Windows 2003/ IIS 6.0. I was stuck with rather a abnormal
behaviour of System.Web.mail class. It was truncating the message body
after 3,071 character. The code i was testing was:

Import Namespace="Syst em.Web.Mail"
Dim aa as new StringBuilder(6 00010)
Dim i as Integer

For i = 1 to 60000
aa = aa.Append("a")
next

aa = aa.Append("end" )
Dim objMailMessage As New MailMessage
objMailMessage = New MailMessage
'send mail
TRY
With objMailMessage
.To = "ab*@myDomain.c om"
.From = "su*****@myDoma in.info"
.Subject = "Test Webmail"
.BodyFormat = MailFormat.Text
.Body = len(aa.Tostring ()) & "--" & aa.Tostring()
End With

SmtpMail.Send(o bjMailMessage)
CATCH
response.write (err.descriptio n)
END TRY

response.write ("<br><br>" & aa.Tostring() & "<br>end<br >")

I modified the settings of IIS SMPT and removed all the constraints. I
also checked with my incoming POP server. I checked with Classic ASP
and everything work fine.

I even tried setting the BodyEncoding property of the mailMessage
object to different options but to no avail.

I just inserted CHR(10) at the position where it was truncating and IT
WORKED.

I still could not figure out the logical reason behind it. Anyone here
could throw some light on it ??

Regards.
Jitesh Sinha

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4964
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
1
1680
by: mg | last post by:
I've been sending e-mail messages without difficulty using message.Body = msgText until I increased to a size that causes the received message to be truncated. Is there a limit to the size of msgText? If not how can I make it hold a longer string?
2
500
by: Ben | last post by:
I have several pages written in aspx, but sometime the aspx page return the following error. And it hapeen, the whole web application gives this error, that means all the aspx files get affected. Any ideas? Here is the error: Server Error in '/' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred...
4
1200
by: Bob | last post by:
This code snippet works fine (vs 2005) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim message As New MailMessage() Try message.From = New MailAddress("myname@mydomain.com") message.To.Add(New MailAddress("myname@mydomain.com")) message.Subject = "Test" message.Body = "Test body" Dim Client As New SmtpClient()
1
1481
by: Bob | last post by:
Vs2005 - Framework2. Just to let all of you know. I have found that I can not use an application to send e-mails using the system,net.mail namespace while Outlook express is opened on the same machine from which my program is trying to send an e-mail using smtp mail set to the same smtp server account as the currently selected outlook mail account. (code snippet follows at end) the application just does not send e-mail and no exception is...
2
4321
by: Tim | last post by:
I am trying to send a simple mail message using windows forms in VB.NET 2005. When executing the code, I get a general 'Configuration system failed to initialize' error message when the code instatiates a new MailMessage object (see below) My form has the following code: Imports System.Net.Mail Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
2
17489
by: clevrmnkey | last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I finally need to make them work, and I can't for the life of me see what I'm doing wrong. I pared back my mail transaction to the bare minimum: System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("<my mail server IP>", 25); smtp.Send("<one of my email addresses>", "<another of my email addresses>", "Hello", "World");
5
9739
by: =?Utf-8?B?SmltSm9i?= | last post by:
Hi All, I am using c# to build an application. I want a button that will be able to open a new mail message with an attachment. The new mail message works but I can't get the attachment to work - there is no error message just no attachment. Any ideas? Code i am using is; System.Diagnostics.Process.Start("mailto:email@email.com?subject=Software&body=see attachment&attachment=c:/myview.mht"); Thanks
2
18173
by: anu b | last post by:
Now i am sending email to my friend using session variable... but my code is as below private bool SendEmail(string email) { try
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.