|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Attachments in VS2003 web mailDim 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 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 Show quoteHide quote "Robert Dufour" <bduf***@sgiims.com> schreef in bericht news:eW$rI0xEHHA.4832@TK2MSFTNGP06.phx.gbl... > 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 > > > >
Read and write database
Help - Timing Logic Datagridview...cell contents Newbie Question here Newbie help: How to detect when a worker thread ihas completed normaly Unable to write to file in my web site Serial ports. [OT] VB.Net and MS Access Why does Join method call sit there forever? communicate with Activesync? Can it be done? |
|||||||||||||||||||||||