Link to home
Start Free TrialLog in
Avatar of Vadik
Vadik

asked on

how to send mail?

Give me example of using senddoc function of the smtp-component of Delphi2,3.I want to send my file c:\temp\myfile.txt to mail@whom.net.
Avatar of sburck
sburck

Straight from the help file of Delphi 4, I don't know if it's back compatible with the older versions, but assuming it is, I tried this and it worked fine.

procedure TForm1.SendBtnClick(Sender: TObject);
begin
  NMSMTP1.PostMessage.FromAddress := LAddress.Text;
  NMSMTP1.PostMessage.FromName := LName.Text;
  NMSMTP1.PostMessage.ToAddress.Add(ToField.Text);
  NMSMTP1.PostMessage.ToCarbonCopy.Add(CCField.Text);
  NMSMTP1.PostMessage.ToBlindCarbonCopy.Add(BCCField.Text);
  NMSMTP1.PostMessage.Body.AddStrings(BodyField.Lines);
  NMSMTP1.PostMessage.Attachments.AddStrings(AttachmentsField.Lines);
  NMSMTP1.PostMessage.Subject := SubjectField.Text;
  NMSMTP1.PostMessage.LocalProgram := 'NMSMTP Demo';
  NMSMTP1.SendMail;
end;
Avatar of Vadik

ASKER

Hi sburck! Unfortunately it doesn't work in D2,3 :-(  There is no PostMessage method in SMTP-component.  
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial