How to send an email...

I would like my program to send a mail, but I don't want it to launch another program first... Is there an easy way to do this?

I use Delphi4 client/server-edition.

If someone should suggest a component, then please give me an eksample using it...

regards
retep
retepAsked:
Who is Participating?
 
intheConnect With a Mentor Commented:
hi,
i recommend temail32 it great mapi component and comes with 3 examples.
can be found on torrys :
http://www.torry.ru/internet.htm

or just use the smtp component on you internet components tab :
example:

nmsmtp1.PostMessage.Attachments := list of filenames;
nmsmtp1.PostMessage.FromAdress := ...
nmsmtp1.PostMessage.ToAddress := ..
nmsmtp.postmesage. othersettings := ..
nmsmtp1.sendmail;

Regards Barry

0
 
retepAuthor Commented:
Hi InThe :-)

Thanks for your reply. Could you give me a full eksample of how to use Tnmsmtp? I've tried it, but can't seem to make it work. I'll gladly post more points if needed.


Retep

0
 
rwilson032697Commented:
There is a good one in the stmp demo in $(Delphi)\demos\fastnet\smtp (though it may have more detail than you need - take a look).

Cheers,

Raymond.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
intheCommented:
there is good example in delphi\demos\intenet\smtp directory

but here another:



procedure TForm1.Button1Click(Sender: TObject);
begin
  if not(nmsmtp1.Connected)
  then begin
    nmsmtp1.Host:= 'mail.enterprise.net';
    nmsmtp1.UserID := 'your userid';
    nmsmtp1.Connect;
  end;

  if nmsmtp1.Connected
  then
  begin
    nmsmtp1.ClearParams := True;
    nmsmtp1.SubType := mtPlain;
    nmsmtp1.EncodeType := uuMime;
    nmsmtp1.PostMessage.FromAddress := 'Legend@Enterprise.Net';
    nmsmtp1.PostMessage.ReplyTo := nmsmtp1.PostMessage.FromAddress;
    nmsmtp1.PostMessage.FromName := 'Barry';
    nmsmtp1.PostMessage.ToAddress.Add('BorgsAssmilate@Aol.Com');
    nmsmtp1.PostMessage.Body.AddStrings(Memo1.lines);
    nmsmtp1.PostMessage.Subject := 'A Test';
    nmsmtp1.PostMessage.Date := DateToStr(Date);
    nmsmtp1.SendMail;
    MessageDlg('Mail sent', mtInformation, [mbOk], 0);
  end
  else
    MessageDlg('NOT connected', mtInformation, [mbOk], 0);
end;



Regards Barry
0
 
intheCommented:
;-)  nice timing raymond
0
 
rwilson032697Commented:
Of course, in D4 the path would be $(Delphi)\demos\internet\smtp :-)

Cheers,

Raymond.
0
 
rwilson032697Commented:
Snap!
0
 
retepAuthor Commented:
Thanks a lot!!!

You have no idea how much time I have spend trying to make it work :-)
0
All Courses

From novice to tech pro — start learning today.