Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Download POP3 Email and Save To EML File Format
Downloads e-mail from a POP3 server and saves each email to a separate .eml file. // Read a POP3 mailbox and save emails to .eml files. procedure TForm1.Button25Click(Sender: TObject); var email: CHILKATMAILLib2_TLB.IChilkatEmail2; bundle: IChilkatEmailBundle2; n: Integer; i: Integer; begin // A ChilkatMailMan2 ActiveX component was dropped onto the Delphi // form, and this became the Form's member variable "ChilkatMailMan21". // Unlock the component -- only needs to be called once in a program. ChilkatMailMan21.UnlockComponent('Anything for 30-day trial'); // Set the POP3 mail server hostname, login, and password. ChilkatMailMan21.MailHost := 'mail.chilkatsoft.com'; ChilkatMailMan21.PopUsername := 'mylogin'; ChilkatMailMan21.PopPassword := 'mypassword'; // Read the entire mailbox, leaving the mail on the POP3 server. // Call TransferMail() instead to download the email from the mailbox. bundle := ChilkatMailMan21.CopyMail(); if (bundle = nil) then ShowMessage(ChilkatMailMan21.LastErrorText); // Loop over the emails in the bundle and save each to a .eml n := bundle.MessageCount; for i := 0 to n-1 do begin email := bundle.GetEmail(i); email.SaveEml('email_' + IntToStr(i) + '.eml') end; end;
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.