Solved

Listbox Help

Posted on 2006-10-24
5
177 Views
Last Modified: 2010-04-05
I have an email program that sends out emails to multiple people.

I have a listbox with a list of different emails to send to.  Then I have 2 other listboxes.  One will contain specific email addresses that won't be sent to.  The other will contain whole domains that won't be sent to.

For example:

Listbox with emails:         Specific Emails Listbox:         Domains Listbox:

blah1@yahoo.com           blah1@yahoo.com                @hotmail.com
blah2@yahoo.com
blah1@hotmail.com
blah2@hotmail.com

It should email to only blah2@yahoo.com because it has blah2@yahoo.com in the block list and the @hotmail.com addresses blocked.

Any ideas?

0
Comment
Question by:Grant Fullen
5 Comments
 
LVL 8

Accepted Solution

by:
RickJ earned 25 total points
ID: 17801196
Something like this...
var idx : integer ;

for idx := 0 to EmailListBox.Count - 1 do begin
  if (BlockedEmails.Items.Indexof(EmailListBox.Items[Idx]) = -1) and
     (BlockedDomains.Items.Indexof(Copy(EmailListBox.Items[Idx], Pos('@', EmailListBox.Items[Idx]), Length(EmailListBox.Items[Idx])) = -1)  then

  SendEmailProc ;
end ;

Dont have delphi in front of me, so sorry if any mistakes.
0
 

Author Comment

by:Grant Fullen
ID: 17806877
How do I use that to add to the recipients list?

Like:

EmailClient1.Recipients.Add("emails that didn't get blocked")
0
 
LVL 28

Expert Comment

by:TName
ID: 17807404
>How do I use that to add to the recipients list?

Simply add any EmailListBox item that has passed RickJ' two conditions:

 for idx := 0 to EmailListBox.Count - 1 do begin
    if (BlockedEmails.Items.Indexof(EmailListBox.Items[idx])=-1) and
      (BlockedDomains.Items.Indexof(Copy(EmailListBox.Items[idx],Pos('@', EmailListBox.Items[idx]), Length(EmailListBox.Items[idx])))=-1) then    //minor addition
           EmailClient1.Recipients.Add(EmailListBox.Items[idx]);  
 end;
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 17808219
please tell me this isn't a spam bot
0
 

Author Comment

by:Grant Fullen
ID: 17808959
TheRealLoki the only spam here is your post.

Don't leave ignorant posts that aren't even related to the subject.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

18 Experts available now in Live!

Get 1:1 Help Now