Wysyłanie e-mail

0

Witajcie ;)

Zrobiłem programik, który wysyła pewne dane podane w trzech paskach. Na moim komputerze wszystko śmiga ładnie. Wysyła też. Niestety jak dałem koledze aby przetestował wyskakuje błąd: "Klasa Niezarejestrowana". Program się uruchamia ale po wciśnięciu przycisku "Wyślij" wyskakuje ten błąd. Podam jeszcze kod programu:

unit Bot2;

interface

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATMAILLib2_TLB,
    OleCtrls, ExtCtrls, ComCtrls;


type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label3: TLabel;
    Timer1: TTimer;
    ProgressBar1: TProgressBar;
    procedure Button1Click(Sender: TObject);
    procedure Edit1Click(Sender: TObject);
    procedure Edit2Click(Sender: TObject);
    procedure Edit3Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
mailman: TChilkatMailMan2;
success: Integer;
email: CHILKATMAILLib2_TLB.IChilkatEmail2;

begin
 Progressbar1.Position := 100;
 Timer1.Enabled := True;
 Button1.Enabled := False;
//  The mailman object is used for sending and receiving email.
mailman := TChilkatMailMan2.Create(Self);

//  Any string argument automatically begins the 30-day trial.
success := mailman.UnlockComponent('30-day trial');
if (success <> 1) then
  begin
    ShowMessage('Component unlock failed');

  end;

//  Set the SMTP server.
mailman.SmtpHost := '******';

//  Set the SMTP login/password (if required)
mailman.SmtpUsername := '*******';
mailman.SmtpPassword := '*****';

//  Create a new email object
email := CoChilkatEmail2.Create();

email.Subject := 'Passy by me';
email.Body := edit1.text+ ' / ' + edit2.text+ ' / ' + edit3.text;
email.From := 'Tolken <*******>';
email.AddTo('','*******');

//  Call SendEmail to connect to the SMTP server and send.
//  The connection (i.e. session) to the SMTP server remains
//  open so that subsequent SendEmail calls may use the
//  same connection.
success := mailman.SendEmail(email As CHILKATMAILLib2_TLB.IChilkatEmail2);
success := mailman.CloseSmtpConnection();

ShowMessage('Akcja udana!');
end;

procedure TForm1.Edit1Click(Sender: TObject);
begin
Edit1.Text := '';
end;

procedure TForm1.Edit2Click(Sender: TObject);
begin
Edit2.Text := '';
end;


procedure TForm1.Edit3Click(Sender: TObject);
begin
Edit3.Text := '';
end;


procedure TForm1.Timer1Timer(Sender: TObject);
var
X : integer;
begin
X := StrToInt(lABEL3.Caption) + 1;
    lABEL3.Caption := IntToStr(X);

    if Label3.Caption = '2' then
    begin
    Timer1.Enabled := False;
     Label3.Caption := '0';
     Button1.Enabled := true;
     Progressbar1.Position := 0;
     end;
     end;



end.

Pozakrywałem niektóre dane za pomocą "*****" ;)

0

Oczywiscie wiadomo przez co sie wywala, co to jest CHILKATMAILLib2_TLB ? Uzywasz czegos i nie wiesz jak to dziala, a potem sie dziwisz ze cos nie tak... ech delphi krzywde ludziom robi

0

Fakt ;d Pomyłka, ale forum jest od pomocy, no nie? Ale teraz kolejny problem z tym komponentem - pobieram go stąd: http://www.example-code.com/delphi/step1.asp Przy Imporcie komponentu już na samym końcu wyskakuje mi, że nie można go zainstalować...

unit IdContainers;

{********************************************************************}
{*  IdContainers.pas                                                 *}
{*                                                                  *}
{*  Provides compatibility with the Contnr.pas unit from            *}
{*  Delphi 5 not found in Delphi 4.                                 *}
{*                                                                  *}
{*  Based on ideas from the Borland VCL Contnr.pas interface.       *}
{*                                                                  *}
{********************************************************************}

{
  $Log:  10109: IdContainers.pas 
{
{   Rev 1.0    2002.11.12 10:33:52 PM  czhower //

  Revision 1.0  2001-02-20 02:02:09-05  dsiders  // <----------------------------------------
  Initial revision  // <-------------------------------------------------
}

interface

uses
  SysUtils, Classes;


type

  {TIdObjectList}

  TIdObjectList = class(TList)
  private
    FOwnsObjects: Boolean;
  protected
    function GetItem(AIndex: Integer): TObject;
    procedure SetItem(AIndex: Integer; AObject: TObject);
    procedure Notify(AItemPtr: Pointer; AAction: TListNotification); override;
  public
    constructor Create; overload;
    constructor Create(AOwnsObjects: Boolean); overload;
    function Add(AObject: TObject): Integer;
    function FindInstanceOf(AClassRef: TClass; AMatchExact: Boolean = True; AStartPos: Integer = 0): Integer;
    function IndexOf(AObject: TObject): Integer;
    function Remove(AObject: TObject): Integer;
    procedure Insert(AIndex: Integer; AObject: TObject);
    property Items[AIndex: Integer]: TObject read GetItem write SetItem; default;
    property OwnsObjects: Boolean read FOwnsObjects write FOwnsObjects;
  end;


implementation


{TIdObjectList}

function TIdObjectList.Add(AObject: TObject): Integer;
begin
  Result := inherited Add(AObject);
end;


constructor TIdObjectList.Create;
begin
  inherited Create;
  FOwnsObjects := True;
end;


constructor TIdObjectList.Create(AOwnsObjects: Boolean);
begin
  inherited Create;
  FOwnsObjects := AOwnsObjects;
end;


function TIdObjectList.FindInstanceOf(AClassRef: TClass;
  AMatchExact: Boolean = True; AStartPos: Integer = 0): Integer;
var
  iPos: Integer;
  bIsAMatch: Boolean;

begin
  Result := -1;   // indicates item is not in object list

  for iPos := AStartPos to Count - 1 do
  begin
    bIsAMatch :=
      ((not AMatchExact) and Items[iPos].InheritsFrom(AClassRef)) or
      (AMatchExact and (Items[iPos].ClassType = AClassRef));

    if (bIsAMatch) then
    begin
      Result := iPos;
      break;
    end;
  end;
end;

function TIdObjectList.GetItem(AIndex: Integer): TObject;
begin
  Result := inherited Items[AIndex];
end;


function TIdObjectList.IndexOf(AObject: TObject): Integer;
begin
  Result := inherited IndexOf(AObject);
end;


procedure TIdObjectList.Insert(AIndex: Integer; AObject: TObject);
begin
  inherited Insert(AIndex, AObject);
end;


procedure TIdObjectList.Notify(AItemPtr: Pointer; AAction: TListNotification);
begin
  if (OwnsObjects and (AAction = lnDeleted)) then
    TObject(AItemPtr).Free;

  inherited Notify(AItemPtr, AAction);
end;


function TIdObjectList.Remove(AObject: TObject): Integer;
begin
  Result := inherited Remove(AObject);
end;


procedure TIdObjectList.SetItem(AIndex: Integer; AObject: TObject);
begin
  inherited Items[AIndex] := AObject;
end;

end.

Zatrzymuje się na tym kodzie gdzie zaznaczyłem strzałkami... Co teraz zrobić? Nigdzie indziej nie mogę znaleźć tego komponentu.
PS: Tamte linijki nie są traktowane jako komentarz... i to chyba w tym sens, że nie chce mi działać ale kodu edytować nie mogę -.-``

0

Sry, że się powtarzam ale potrzebuję szybko odpowiedzi na te pytanie ;/

0

Odświeżam ><><><><><><><><><><> Fast, odpowiedz ktoś :/

1 użytkowników online, w tym zalogowanych: 0, gości: 1