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

Notifications

Announcements

No record found.

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)
  • srttel Profile Picture
    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
    414 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
    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

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans