An argument of the Attachment.Save method is a path to the file to write the content to. If you specify just the filename (without a path), the attachment will be written usually to the directory your application has been executed from.
Anyway, I'd recommend you to specify a full path e.g. following way:
Dim outputPath As String = "c:\temp"
In your example above, you have a typo (maybe intentional, for debug purposes). In the following line:
message = client.GetMailMessage(list(0).SequenceNumber)
you will always obtain the oldest message from the list only (with a 0 index). You should replace it with:
message = client.GetMailMessage(list(sequenceNumber).SequenceNumber)
And please note that the
sequenceNumber variable holds something different than the SequenceNumber property of POP3 messages. The variable is just an index in the
list collection and the collection is indexed from
So the whole code should look like this:
Dim client = New Pop3()
' specify connection data for your server'
' specify path on your computer, where the atachments should be written to'
Dim outputPath = "c:\temp"
Dim list = client.GetMessageList()
Dim i = 0
While i < list.Count
Dim message = client.GetMailMessage(list(i).SequenceNumber)
For Each attachment In message.Attachments
i = i + 1