Attachments in VS2003 web mail

R

Robert Dufour

In a windows form app the code I got is
Dim AttachItem As String

If MailAttachments <> "" Then 'The fully qualified paths of all the files
that I want to attach

Dim delimStr As String = ";"

Dim delimiter As Char() = delimStr.ToCharArray()

Dim split As String() = Nothing

split = MailAttachments.Split(delimiter)

For Each AttachItem In split

Dim attachment As New MailAttachment(AttachItem) 'create the attachment

mailMsg.Attachments.Add(attachment) 'add the attachment

Next AttachItem

End If

The line

mailMsg.Attachments.Add(attachment) 'add the attachment does not work the
attachment does not get added when I send the mail I get an object not
created error caused by the attachments I tried to add.

What would be the correct syntax?

I've seen Dim attachment As New MailAttachment(Server.MapPath("test.txt"))
'create the attachment but I think that only works for asp pages in my app
in winforms I get Server is not defined.

I had this stuff working OK in framework 2 and vs2005 but because of
limitations imposed by another third party I'm stuck with framework1.1

Thanks for any help

BOB
 
C

Cor Ligthert [MVP]

Robert,

With SMTP their should not be a difference for version 1.1 or 2.0 mostly it
is the IIS SMTP server where is the problem.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top