4AspNet POP3 .NET Component

Attachment.Save Method 

Save the attached file.

[Visual Basic]
Public Sub Save( _
   ByVal FileName As String _
)
[C#]
public void Save(
   string FileName
);

Parameters

FileName
Name of the attached file

Example

This sample shows how to call the Save method.

ForAspNet.POP3.License.LicenseKey = "<put license string here>";
POP3 objPOP3 = new POP3("mail.server.com", "username", "password");
objPOP3.Connect();
objPOP3.Login();
objPOP3.QueryServer();
for (int i = 1; i <= objPOP3.TotalMailCount; i++)
{
    EmailMessage objEmail = objPOP3.GetMessage(i, false);
    if (objEmail.IsAnyAttachments)
    {
        for(int a = 0; a < objEmail.Attachments.Count; a++)
        {
            Attachment objFile = (Attachment)objEmail.Attachments[a];
            if (objFile.IsFileAttachment) objFile.Save("c:\\" + objFile.FileName);
        }
    }
    objPOP3.DeleteMessage(i);
}
objPOP3.Close();

See Also

Attachment Class | ForAspNet.POP3 Namespace