Send data from my program to email

I want my program to let users to send data to my email (LIKE order form).
like thes:

******ORDER FORM***********
EMAIL:
NAME:
PHONE:
ADRESS:
**************************

sal1150Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fredhansenCommented:
Hi,
I send emails using smtp component of Synapse package. You can download this package from http://www.ararat.cz/synapse.

Put the order in the boby of the email:
Maildata.Add('**** order form ****');
Maildata.add('email:....')

Try the following syntax:
function SendTo(const MailFrom, MailTo, Subject, SMTPHost: string; const MailData: TStrings): Boolean;

and use the help of Synapse for more options.

pcsentinelCommented:
You can use the INDY TIdSMTP Component then the code is a simple as

procedure SendMail(Host,Subject,MailTo,From,Msg: string);
var
 lSMTP: TIdSMTP;
begin
  try
    lSMTP:=TIdSMTP.Create(nil);
    lSMTP.QuickSend(Host,Subject,MailTo,From,Msg);
    FreeAndNil(lSMTP);
    Result:=true;
  except
    raise;
    Result:=false;
  end;
end;

regards
carcotasuCommented:
try to use a OfficePartner component it's free and have demo application, it's a strong components.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

sal1150Author Commented:
Hi pcsentinel
Can you give me  full example

points now are 350
pcsentinelCommented:
Ok sal here you are, it uses Indy 9 which can be downloaded from www.atozed.com or sourceforge

*********************UNIT CODE***********************
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  IdMessageClient, IdSMTP, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    edHost: TEdit;
    edSubject: TEdit;
    edTo: TEdit;
    memMail: TMemo;
    edFrom: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    function SendMail(Host, Subject, MailTo, From, Msg: string): boolean;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

function TForm1.SendMail(Host,Subject,MailTo,From,Msg: string): boolean;
var
      lSMTP: TIdSMTP;
begin
  try
    lSMTP:=TIdSMTP.Create(nil);
    lSMTP.QuickSend(Host,Subject,MailTo,From,Msg);
    FreeAndNil(lSMTP);
    Result:=true;
  except
    raise;
    Result:=false;
  end;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
      SendMail(edHost.Text,edSubject.Text,edTo.Text,edFrom.Text,memMail.Text);
end;

end.


***********************FORM CODE************************
object Form1: TForm1
  Left = 100
  Top = 447
  Width = 410
  Height = 238
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 112
    Top = 20
    Width = 64
    Height = 13
    Caption = 'SMTP Server'
  end
  object Label2: TLabel
    Left = 112
    Top = 44
    Width = 13
    Height = 13
    Caption = 'To'
  end
  object Label3: TLabel
    Left = 112
    Top = 64
    Width = 23
    Height = 13
    Caption = 'From'
  end
  object Label4: TLabel
    Left = 112
    Top = 92
    Width = 36
    Height = 13
    Caption = 'Subject'
  end
  object Label5: TLabel
    Left = 112
    Top = 116
    Width = 59
    Height = 13
    Caption = 'Mail Content'
  end
  object Button1: TButton
    Left = 8
    Top = 172
    Width = 75
    Height = 25
    Caption = 'Send Mail'
    TabOrder = 0
    OnClick = Button1Click
  end
  object edHost: TEdit
    Left = 188
    Top = 16
    Width = 193
    Height = 21
    TabOrder = 1
    Text = 'YourSMTPServer'
  end
  object edSubject: TEdit
    Left = 188
    Top = 88
    Width = 193
    Height = 21
    TabOrder = 2
    Text = 'Subject'
  end
  object edTo: TEdit
    Left = 188
    Top = 40
    Width = 193
    Height = 21
    TabOrder = 3
    Text = 'sal1150@somewhere.com'
  end
  object memMail: TMemo
    Left = 188
    Top = 112
    Width = 193
    Height = 85
    Lines.Strings = (
      'The text you want to send')
    TabOrder = 4
  end
  object edFrom: TEdit
    Left = 188
    Top = 64
    Width = 193
    Height = 21
    TabOrder = 5
    Text = 'someone@somewhereelse.com'
  end
end


hope this helps


regards

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sal1150Author Commented:
HI
good
but can you give me short information about 'SMTP Server' and how can I get it/
sal1150Author Commented:
my email is
sal_soft@hotmail.com
pcsentinelCommented:
SMTP Servers are just email servers, so your ISP or internal network will already have on set up.

so if your ISP was say yellow the address of the smtp server might be smtp.yellow.com, check with your ISP for details


regards
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.