[thelist] ASP Loop

Christian Anderson chris at jobdragon.com
Wed Mar 19 03:26:12 CST 2003


Hi there,

I'm using JMail to get mail off my server, handle attachments etc.  I found
a script that is automatically checking it, but there is one thing that I
want to change.

Right now its cycling through and getting ALL the attachments that are with
the message, and saving them.  With the application that I developed, I want
it to just get the first attachment, and then skip all the rest.

Can anyone modify this code to make it just take the first one and then move
on?

Function getAttachments()
  Set Attachments = msg.Attachments
   separator = ", "

  For i = 0 To Attachments.Count - 1
    If i = Attachments.Count - 1 Then
      separator = ""
    End If

  Set at = Attachments(i)
  at.SaveToFile( "c:\hshome\photokyo\blogzilla.jp\attachments\" & at.Name )
  getAttachments = getAttachments & "<a href=""/attachments/" &_
  at.Name &""">" & at.Name & "(" & at.Size & " bytes)" &_
  "</a>" & separator
  Next
End Function

Function dbAttachments()
  Set Attachments = msg.Attachments
   separator = ", "

  For i = 0 To Attachments.Count - 1
    If i = Attachments.Count - 1 Then
      separator = ""
    End If

  Set at = Attachments(i)
  dbAttachments = dbAttachments & at.Name
  Next
End Function


More information about the thelist mailing list