Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sening Email

Status
Not open for further replies.

YamahaJojje

Programmer
May 27, 2004
11
SE
Hi!

Is it possible to send an email from delphi? Is there any good component? It should be without user nowing it.

Thx
 
or with Indy components you can write something like:

Code:
  :
type
  TForm1 = class(TForm)
    Mail: TIdSMTP;
    MailMessage: TIdMessage;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

procedure TForm1.Button1Click(Sender: TObject);
Begin
  Mail.Host := 'smtp-server.socal.rr.com'; // your ISP SMTP server name
  Mail.UserId := 'userid';
  Mail.Password := 'password';
  MailMessage.From.Address := 'socal.rr.com';
  MailMessage.From.Name    := 'Whole Name';
  MailMessage.From.Text    := 'userid@socal.rr.com';
  MailMessage.Recipients.Add.Address := 'whoever@yahoo.com';
  MailMessage.Recipients.Add.Address := 'anotherperson@hotmail.com';
  MailMessage.Subject := 'The Subject You Want Shown';
  MailMessage.Body.Add('Line 1');
  MailMessage.Body.Add('Line 2');
  Mail.Connect;
  Mail.Send(MailMessage);
  Mail.Disconnect;
End;
 :

Regards and HTH,
JGS
 
I wrote an FAQ which also outlines methods of sending email via Delphi. I think you'd be more interested in the second suggestion (MAPI).

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Sorry, forgot to add the FAQ link:
faq102-3600

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top