Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Mail message attachement problem

Reply
Thread Tools

Mail message attachement problem

 
 
Eric
Guest
Posts: n/a
 
      04-23-2010
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


 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      04-23-2010
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/4...-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"


 
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
Mail message attachement problem Eric ASP .Net 1 04-23-2010 07:57 AM
saving an e-mail attachement robinsiebler@gmail.com Python 1 08-01-2008 08:08 AM
Send style sheet as an attachement in a mail subhadeep.de@gmail.com Java 1 02-26-2005 01:32 PM
Re: Error in sending attachement with Smtp.Mail Scott Allen ASP .Net 2 02-17-2004 04:36 AM
Java Mail Question : Attachement Problems Lee Java 3 11-04-2003 01:56 PM



Advertisments