Options

Avoid to send email to contacts with same e-mail

RikarddoRikarddo Member Posts: 80
edited 2018-05-16 in NAV Three Tier
Hi all,

Imagine this possible situation

I have contact A with e-mail X, and contact B with same e-mail X.
I'm making a a function to go though all contacts and send an email, but in this case i don't wan't that contact B receive another e-mail.
Contact.RESET;
Contact.SETRANGE("No.","No.");
Contact.SETFILTER(Contact."E-Mail",'<>%1','');

IF Contact.FINDSET THEN REPEAT 
  Recipients:=Contact."E-Mail";




//Recipients:='roliveira@sameca.com';//
SMTPMailSetup.GET;
SMTPMail.CreateMessage(
  '',
  'roliveira@sameca.com',
  Recipients,
  TestMailTitleTxt1,
  STRSUBSTNO(
    MailBody,
    USERID),TRUE);
SMTPMail.Send;

UNTIL Contact.NEXT=0;

Im thinking of using a temp table and whenever an e-mail is sent the address will be inserted in that table and then check before send the e-mail if it already exists in the table.

Would like to read some opinions. Thanks

Comments

Sign In or Register to comment.