From: Eric on
Hi,

I'm working on a ASP.Net website where I use the MailMessage method to send
a report filled in by the user to a given email address.
The user can also upload an attachement to be put in the data part of the
report.

If the attachement is less then 1,7 Mb there is no problem, the email is sent.
Any larger attachement and I get an error stating "the message could not be
sent"

The webserver is an IIS7 and I use the local smtp server (via IIS6) to send
the emails.
In the settings of the smtp server I have unchecked the email size
limitations. At first I had it set to 8192 Kb, but for testing I removed the
limit.

Unfortunalty the emails are not sent, I don't even see them appear in the
mailroot/queue folder. (the smaller emails I do see)

I have put the timout property of the SmtpClient to 300 secs, so it should
have enough time to send the message.

What is going wrong here?

Dim smtpC As SmtpClient

Dim message As New MailMessage
message.To.Add(New MailAddress(rc.sEmailOntvanger))
message.From = New MailAddress(rc.sEmailZender)
message.Subject = "RIE report for site " & rc.sSitenummer
message.Body = strbody.ToString
message.BodyEncoding = System.Text.Encoding.Unicode
message.IsBodyHtml = True

message.Attachments.Add(data1)
data1 = Nothing

'attach PDF file to message
Dim RapportPDFName As String = Server.MapPath("~\") &
FormFile.Replace("/", "\")
data1 = New Attachment(RapportPDFName, MediaTypeNames.Application.Octet)
Try
' Add time stamp information for the file.
disposition1 = data1.ContentDisposition
disposition1.CreationDate =
System.IO.File.GetCreationTime(RapportPDFName)
disposition1.ModificationDate =
System.IO.File.GetLastWriteTime(RapportPDFName)
disposition1.ReadDate = System.IO.File.GetLastAccessTime(RapportPDFName)
Catch ex As Exception
ClientScript.RegisterStartupScript(Me.GetType(), "alert",
"<script>alert('Error');</script>")
message.Dispose()
data1 = Nothing
disposition1 = Nothing
Exit Sub
End Try
message.Attachments.Add(data1)
data1 = Nothing


smtpC = New SmtpClient("localhost", 25)
smtpC.UseDefaultCredentials = False
smtpC.DeliveryMethod = SmtpDeliveryMethod.Network
smtpC.Timeout = 300000

Try
smtpC.Send(message)
message.Dispose()
disposition1 = Nothing
data1 = Nothing
Catch ex As Exception
message.Dispose()
disposition1 = Nothing
data1 = Nothing
ClientScript.RegisterStartupScript(Me.GetType(), "alert",
"<script>alert('Het was niet mogelijk om het rapport te emailen. -1-" +
smtpC.Host + "');</script>")
Exit Sub
End Try

rg,
Eric


From: Bob Barrows on
Eric wrote:
> Hi,
>
> I'm working on a ASP.Net website

***canned wrong-newsgroup reply************************
There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic (COM-based) asp newsgroup.
ASP.Net bears very little resemblance to classic ASP so, while you may be
lucky enough to find a dotnet-knowledgeable person here who can answer your
question, you can eliminate the luck factor by posting your question to a
group where those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.
******************************************************************


> where I use the MailMessage method
> to send
> a report filled in by the user to a given email address.
> The user can also upload an attachement to be put in the data part of
> the report.

I suspect this is the problem:
http://bytes.com/topic/net/answers/426571-request-exceeds-limit

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"