473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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="System.Web.Mail"
Dim aa as new StringBuilder(600010)
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.com"
.From = "su*****@myDomain.info"
.Subject = "Test Webmail"
.BodyFormat = MailFormat.Text
.Body = len(aa.Tostring()) & "--" & aa.Tostring()
End With

SmtpMail.Send(objMailMessage)
CATCH
response.write (err.description)
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 2499
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.AppendText("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****@getwebdomains.com> wrote in message
news:ae**************************@posting.google.c om...
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="System.Web.Mail"
Dim aa as new StringBuilder(600010)
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.com"
.From = "su*****@myDomain.info"
.Subject = "Test Webmail"
.BodyFormat = MailFormat.Text
.Body = len(aa.Tostring()) & "--" & aa.Tostring()
End With

SmtpMail.Send(objMailMessage)
CATCH
response.write (err.description)
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
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...
1
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...
2
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....
4
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...
1
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...
2
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...
2
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...
5
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...
2
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.