Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send Mail in Delphi
This is a very simple Delphi program to send mail. Refer to Getting Started for more information. Note: In this example, the TChilkatMailMan2 object is dragged-and-dropped onto the form. A better way of creating the mailman object is to instantiate it dynamically, as in this example: Send Email in Delphi.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, CHILKATMAILLib2_TLB;
type
TForm1 = class(TForm)
ChilkatMailMan21: TChilkatMailMan2;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
email: IChilkatEmail2;
ok: Integer;
begin
ChilkatMailMan21.UnlockComponent('Anything for 30-day trial');
ChilkatMailMan21.SmtpHost := 'smtp.comcast.net';
email := ChilkatMailMan21.NewEmail();
email.Subject := 'This is a test';
email.From := 'Chilkat Support <support@chilkatsoft.com>';
email.AddTo('John Doe','jdoe@someplace.com');
email.Body := 'This is the body...';
ok := ChilkatMailMan21.SendEmail(email);
if (ok = 0) then
ChilkatMailMan21.SaveLastError('errorLog.xml');
end;
end.
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.