[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using Imap4

Posted on 2004-08-15
6
Medium Priority
?
859 Views
Last Modified: 2008-01-09
Hi, I have been developing an email client for a while. So far it is capabale of receiving/rettrieving pop3 mail and sending mail via SMTP. I am at the point where I now want to make my application able to fetch webmail as well (e.g. from yahoo mail & hotmail). I understand that this can be done with the IMAP indy component ?? Can anyone tell me if this assumption is correct...and if not then how can I do this? Also wondering if anyone knows about any examples of how to use this tidIMAP component.. Cheers. R
0
Comment
Question by:Runelurenavn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:Runelurenavn
ID: 11812552
Hi, Thanks for the links. Unfortunately I can only view the questions, not the answers (as far as I am able to tell anyway). Is there another way I can access this information? R
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11812801
Here is the accepted answer for the first link above :

ClientType property is set up to ctNonBlocking by default.

unit Unit1;

// IMAP application demo:

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ScktComp, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    ClientSocket1: TClientSocket;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Memo1: TMemo;
    Label3: TLabel;
    Edit1: TEdit;
    Label4: TLabel;
    Edit2: TEdit;
    Label5: TLabel;
    Edit3: TEdit;
    Timer1: TTimer;
    procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
    procedure Button1Click(Sender: TObject);
    procedure EditChange(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    Response,               // Server response strings
    RequestTag: String;     // Client request tag
    Time: Integer;
  end;

const
  TimeOut = 100;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ClientSocket1Read(Sender: TObject;
  Socket: TCustomWinSocket);
var
  Number, S: String;
  Lines: TStringList;
  I: Integer;
begin
  Response := Response + Socket.ReceiveText;
  // Verify if the response is complete
  if (Response[Length(Response)] in [#10, #13]) then
  begin
    if (RequestTag <> '') then if (Pos(RequestTag, Response) <= 0) then Exit;
    Memo1.Lines.Add(Response);
    Time := 0;
    // Process response if no errors
    if Pos('OK', Response) > 0 then
    begin
      if RequestTag = '' then // Server prompt
      begin
        // Send Login command
        RequestTag := 'A001';
        Socket.SendText('A001 LOGIN ' + Edit2.Text + ' ' + Edit3.Text + #10#13);
      end else if RequestTag = 'A001' then // Login completed
      begin
        RequestTag := 'A142';
        Socket.SendText('A142 SELECT INBOX'#10#13);
      end else
      begin      // Select completed
        // Close socket
        ClientSocket1.Active := false;
        Lines := TStringList.Create;
        try
          // Extract messages number from server responce
          Lines.Text := Response;
          for I := 0 to Lines.Count - 1 do
          begin
            s := LowerCase(Lines.Strings[I]);
            if (Pos('exists', s) > 0) then
            begin
              Number := '';
              while (Lines.Strings[I][Length(Number) + 3] in ['0' .. '9']) do
               Number := Number + Lines.Strings[I][Length(Number) + 3];
              // Display number
              Label2.Caption := Number;
              Break;
            end;
          end;
        finally
          Lines.Free
        end;
        ClientSocket1.Active := false;
        Timer1.Enabled := false;
      end;
    end else
    begin
      Label2.Caption := 'Error';
      ClientSocket1.Active := false;
      Timer1.Enabled := false;
    end;
    Response := '';
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ClientSocket1.Address := Edit1.Text;
  ClientSocket1.Active := true;
  Response := '';
  RequestTag := '';
  Memo1.Clear;
  Time := 0;
  Timer1.Enabled := true;
end;

procedure TForm1.EditChange(Sender: TObject);
begin
  Button1.Enabled := (Edit1.Text <> '') and (Edit2.Text <> '') and
      (Edit3.Text <> '');
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Inc(Time);
  if Time > TimeOut then
  begin
    ClientSocket1.Active := false;
    Label2.Caption := 'error';
    Timer1.Enabled := false;
  end;
end;

end.

This has an errors and timeouts processing.

Complete Delphi 6 source with compiled executable I placed here: http://www.serge.dsip.net/downloads/IMAPdemo.zip .

P. S. Delphi 7 comes with built in IMAP client component (Indy tab).
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Accepted Solution

by:
esoftbg earned 1000 total points
ID: 11812837
Here is the accepted answer for the second link above :

Download the Blue HTTPMail Proxy from http://prdownloads.sourceforge.net/bhttpmail/HttpMailProxy-Win32Bin-v0.02.1.zip?

This app works as a service so it must be on NT, Win2K or WinXP.

There is also HotPOP3 downloadable from http://prdownloads.sourceforge.net/hotpop3/pop3httpproxy.0.0.1.zip?download
that works on any flavor of Windows.

After installing one of these proxies, setup Indy or NMSMTP to access SMTP on localhost or 127.0.0.1 and set your username
and password. All there is to it.
0
 

Author Comment

by:Runelurenavn
ID: 11827783
Hi & thanks for the comments. I am still struggling here...maybe I should have specified that I am using Delphi 7 and the IMAP component that comes with it. So I am not sure if I can use the socket code as a guide?
My program also needs to be compatible with win versions back to (and including) 98..
Just wondering if the hotpop3 download will enable me to retrieve any kind of mail via SMTP??
Thanks. R
0
 

Author Comment

by:Runelurenavn
ID: 11997209
Hi, I have been trying to use the Blue HTTPMail Proxy program to get this going - and it seems to be the best way to go as esoftbg suggested. Just took me a while to realize :)
Now I am stuck on how to use this Blue HTTPMail Proxy program with D7. I have tried connecting to it using idIMAP and idPOP3 components, but it doesn't seem to work....can someone guide me trough this???
I have increased the points since this has been more involved than I anticipated :)
R
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question