Delphi send mail,

Posted on 2003-11-05
Last Modified: 2010-04-03
Hi, i have the following code that uses a memo to store  e-mail addresses,
the memo loads the address from a file and mails to all the addresses, I need to know if you can load it directly from a file using t-stringlist instead of loading it into the memo, if i dont use the memo will it sent to all the addresses in the file?
NMSMTP1.Host :=  smtp server;
       NMSMTP1.PostMessage.ToAddress.AddStrings (memo1.Lines);
       NMSMTP1.PostMessage.FromAddress := '';
       NMSMTP1.PostMessage.Subject := 'subject';
       NMSMTP1.PostMessage.Body.Text :='body';
       NMSMTP1.PostMessage.Attachments.Text := 'c:\file.txt';
i hope you understand..
Question by:herd_bone
  • 2

Accepted Solution

snehanshu earned 60 total points
ID: 9685223
I am not sure if I understood your question.
Doesn't this work: ??

procedure TForm1.Button4Click(Sender: TObject);
  MyLst: TStringList;
     MyLst := TStringList.Create;
       NMSMTP1.Host :=  smtp server;
//       NMSMTP1.PostMessage.ToAddress.AddStrings (memo1.Lines);
       NMSMTP1.PostMessage.FromAddress := '';
       NMSMTP1.PostMessage.Subject := 'subject';
       NMSMTP1.PostMessage.Body.Text :='body';
       NMSMTP1.PostMessage.Attachments.Text := 'c:\file.txt';



Author Comment

ID: 9686627
thanks, works perfect!

Expert Comment

ID: 9686752
Great! Thanks,

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now