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

Announcements

No record found.

News and Announcements icon
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.

  • srttel Profile Picture
    Microsoft Employee on at

    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?

  • Fong Fong Profile Picture
    50 on at

    Hi, i'm using BC onprem v17 here.

  • Suggested answer
    Bilal Haider Profile Picture
    487 on at

    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.

  • Suggested answer
    srttel Profile Picture
    Microsoft Employee on at

    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
    CaptFastBreak Profile Picture
    5 on at

    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,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 741 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 514 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 336 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans