• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

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.
0
Vadik
Asked:
Vadik
1 Solution
 
sburckCommented:
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;
0
 
VadikAuthor Commented:
Hi sburck! Unfortunately it doesn't work in D2,3 :-(  There is no PostMessage method in SMTP-component.  
0
 
intheCommented:
vadik see your other question about this ,the project link i gave you shows exactly how to send a email with a file attachment..
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now