J
Jitesh Sinha
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 address removed)"
.From = "(e-mail address 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
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 address removed)"
.From = "(e-mail address 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