All pastes #344704 Raw Edit

Mine

public text v1 · immutable
·published 2007-02-07 23:00 UTC
rendered paste body
Dim Matches As MatchCollection = Regex.Matches(Message.Body, "\[#(?<attachment>.*)#\]")

            Dim Match As Match
            For Each Match In Matches
                ' Determine whether the attachment is a URL or a local file.
                If Match.Groups("attachment").Value.IndexOf("://") > 0 Then
                    AttachmentPath = DownloadTempFile(Match.Groups("attachment").Value)
                Else
                    AttachmentPath = System.IO.Path.Combine(BasePath, Match.Groups("attachment").Value)
                End If

                ' Confirm that the file does indeed exist
                If System.IO.File.Exists(AttachmentPath) Then Message.Attachments.Add(New Attachment(AttachmentPath))
            Next