Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mail message attachement problem

2 views
Skip to first unread message

Eric

unread,
Apr 23, 2010, 3:13:02 AM4/23/10
to
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


Sanford Whiteman

unread,
Apr 23, 2010, 2:14:13 PM4/23/10
to
> 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.

Have you also removed the session size 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)

What do you see in your SMTP logs?

> smtpC.DeliveryMethod = SmtpDeliveryMethod.Network

What happens if you switch delivery to the drop folder for testing?

-- Sandy

Eric

unread,
Apr 26, 2010, 5:56:01 AM4/26/10
to

"Sanford Whiteman" wrote:

> > 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.
>
> Have you also removed the session size limit?

Yes, I have.

>
> > Unfortunalty the emails are not sent, I don't even see them appear in the
> > mailroot/queue folder. (the smaller emails I do see)
>
> What do you see in your SMTP logs?

There is nothing in the logs at the times I tried to send the emails.
Also the emails without an attachement are not in there.

>
> > smtpC.DeliveryMethod = SmtpDeliveryMethod.Network
>
> What happens if you switch delivery to the drop folder for testing?

I tried it with:

smtpC = New SmtpClient("localhost", 25)

smtpC.UseDefaultCredentials = True
smtpC.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory
smtpC.PickupDirectoryLocation = "C:\\inetpub\mailroot\pickup"
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

but the message, even without an attachement is not sent.


>
> -- Sandy
> .
>

rg.
Eric

Sanford Whiteman

unread,
Apr 26, 2010, 11:12:24 AM4/26/10
to
>> What do you see in your SMTP logs?
>
> There is nothing in the logs at the times I tried to send the emails.

Nothing in the *SMTP logs* (not the queue)? No log of the EHLO?

> but the message, even without an attachement is not sent.

How does it fail? Does it get written to \Pickup or what error is
generated? Also, I think you should just use
SmtpDeliveryMethod.PickupDirectoryFromIis for testing.

-- Sandy

Eric

unread,
Apr 27, 2010, 5:26:01 AM4/27/10
to
> Nothing in the *SMTP logs* (not the queue)? No log of the EHLO?

I have changed the properties of the log settings.
Now I get this after an attempt:

date time c-ip cs-username s-sitename s-computername s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-win32-status sc-bytes cs-bytes time-taken cs-version cs-host cs(User-Agent) cs(Cookie) cs(Referer)
27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1 WIN-DN7S9QRD2LH 127.0.0.1 0 EHLO - =+WIN-DN7S9QRD2LH 250 0 181 20 0 SMTP - - - -
27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1 WIN-DN7S9QRD2LH 127.0.0.1 0 MAIL - +FROM:<ericx...@ericsson.com> 250 0 57 44 0 SMTP - - - -
27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1 WIN-DN7S9QRD2LH 127.0.0.1 0 RCPT - +TO:<ericx...@ericsson.com> 250 0 45 42 0 SMTP - - - -
27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1 WIN-DN7S9QRD2LH 127.0.0.1 0 QUIT - WIN-DN7S9QRD2LH 240 109 46 4 109 SMTP - - - -

To be honest, is doesn't mean anything to me. ;-)

> How does it fail? Does it get written to \Pickup or what error is
> generated? Also, I think you should just use
> SmtpDeliveryMethod.PickupDirectoryFromIis for testing.


No, nothing gets written in the pickup or it is done so fast, I can not
switch to it in time (remote login).
I tried to use the PickupDirectoryFromIis setting, but it gives the same
result.
On the line of smtpc.send() it just throws an exception "Message cannot be
send".

It seems to me that somehow, somewhere there is still a limit that is still
on even though I have unchecked the two limit checkboxes in the properties
of the IIS6 smtp server.

I don't have a clue to where to look.

rg,
Eric


Sanford Whiteman

unread,
Apr 28, 2010, 2:10:11 PM4/28/10
to
> date time c-ip cs-username s-sitename s-computername
> s-ip s-port cs-method cs-uri-stem cs-uri-query
> sc-status sc-win32-status sc-bytes cs-bytes
> time-taken cs-version cs-host cs(User-Agent) cs(Cookie)
> cs(Referer)
> 27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1
> WIN-DN7S9QRD2LH 127.0.0.1 0 EHLO -
> =+WIN-DN7S9QRD2LH 250 0 181 20 0 SMTP
> - - - -
> 27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1
> WIN-DN7S9QRD2LH 127.0.0.1 0 MAIL -
> +FROM:<ericx...@ericsson.com> 250 0 57 44 0
> SMTP - - - -
> 27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1
> WIN-DN7S9QRD2LH 127.0.0.1 0 RCPT -
> +TO:<ericx...@ericsson.com> 250 0 45 42 0
> SMTP - - - -
> 27-4-2010 8:40:16 127.0.0.1 WIN-DN7S9QRD2LH SMTPSVC1
> WIN-DN7S9QRD2LH 127.0.0.1 0 QUIT - WIN-DN7S9QRD2LH
> 240 109 46 4 109 SMTP - - - -

This indicates that the DATA part of the message does not even begin
to be sent.

Can you get a network sniffer (NetMon is fine) on there and actually
see what is transmitted before the QUIT? It is true that the logs are
not as complete as one might like, but they are better than watching
the queue.

> It seems to me that somehow, somewhere there is still a limit that
> is still on even though I have unchecked the two limit checkboxes in
> the properties of the IIS6 smtp server.

Such a limit would not be affecting delivery via drop -- you have
another problem there.

> I don't have a clue to where to look.

Write me off-list and I'm happy to shake it out for you if you can get
me an RDP session -- I'm always up for a challenge (pro bono, no
worries).

-- S.

0 new messages