Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > System.web.mail truncating message body - strange behaviour ??

Reply
Thread Tools

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

 
 
Jitesh Sinha
Guest
Posts: n/a
 
      12-05-2003
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 = "(E-Mail Removed)"
.From = "(E-Mail Removed)"
.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
 
Reply With Quote
 
 
 
 
Munsifali Rashid
Guest
Posts: n/a
 
      12-05-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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 = "(E-Mail Removed)"
> .From = "(E-Mail Removed)"
> .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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strange behaviour with document.body.clientWidth wolfing1@gmail.com Javascript 1 01-17-2007 02:47 PM
Truncating Variables Jason Williard ASP .Net 11 10-18-2004 01:27 PM
New OWA message and Modify body of Message - Steve - ASP .Net 0 07-06-2004 04:54 AM
Size of e-mail message - message.Body = msgText =?Utf-8?B?bWc=?= ASP .Net 1 02-11-2004 07:42 PM
JavaService append mode instead of truncating log file uy_do Java 1 12-04-2003 02:42 AM



Advertisments