web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Using List of Text to insert multiple email address written on one field

(0) ShareShare
ReportReport
Posted on by 50

Hi,

I have variable list of text below

ListEmailTo: List of [Text];

There's a field contain email address in customer called "E-Mail" which sometime add user ";" as email address separator.

For example :

email1@hotmail.com;email2@gmail.com

I added them via

ListEmailTo.Add(Customer."E-Mail");

Then send them using codeunitSMTP.CreateMessage.

It seems there's error because it doesn't recognize them as two email addresses.

But if i just input one of them like 'email1@hotmail.com', it worked just fine.

Is there a proper way to send to multiple address using list of text ? or do i have to separate each of them and add one by one to each index of List of Text ?

Thank you.

I have the same question (0)
  • Suggested answer
    CaptFastBreak Profile Picture
    5 on at
    RE: Using List of Text to insert multiple email address written on one field

    I was facing the same issue..

    Somehow managed to find a solution that works.

    What worked for me was

    var CustEmailText : Text;
    var To_list : List of [Text];
    begin
    ...
    
    CustEmailText := Customer."E-Mail";
    ToList.AddRange(CustEmailText.Split(';'));
    
    ...
    end;


    Text.Split will output a list 

    Hope it helps. 
    Mark as Solution if it does.

    Thanks,

  • Suggested answer
    srttel Profile Picture
    on at
    RE: Using List of Text to insert multiple email address written on one field

    HI,

    with BC 17.1 I can add several receipients to an e-mail.

    Mail.CreateMessage('Sender name''sending@from.com''Test1@toaddress.com''Test email''Test email body', True);
    MailRecp.Add('Test2@toaddress.com');
    MailRecp.Add('Test3@toaddress.com');
    mail.AddRecipients(MailRecp);
    Mail.Send;
  • Suggested answer
    Bilal Haider Profile Picture
    391 on at
    RE: Using List of Text to insert multiple email address written on one field

    Hi,

    If you are taking from customer what is the need to use list. Just copy from customer card in a text variable and then send it to CreateMessage procedure.

    On customer card if email addresses ate separated with ; then system will treat them as different email addresses.

  • Fong Fong Profile Picture
    50 on at
    RE: Using List of Text to insert multiple email address written on one field

    Hi, i'm using BC onprem v17 here.

  • srttel Profile Picture
    on at
    RE: Using List of Text to insert multiple email address written on one field

    Hi Fong Fong,

    can send a mail to two ; separated mail addresses within the application directly when you enter them in a page?

    What version of Dynamics NAV or Business Central are you using?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,678 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,635

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,210

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans