Email to user group

Hi,

I have a requirement to send an email to a user group…

I am using ax 2009.

I have already written the code for single user:

str FromAddress = “verma.mc@gmail.com”;

str ToAddress = “sharath.p@gmail.com”;

str Subject = “New Project Created”;

str Body,messageBody ;

SysMailer mailer = new SysMailer();

;

messageBody = “

Dear Sir/Madam,

A new Project " + projtable.Name + " Has been created.

”;

body = strfmt("%1",messageBody);

mailer.quickSend(fromaddress,toaddress,subject,body);

Its working fine.

I am using user group because the client want to have add or remove the recipients based on the requirement. So, I thought user group is a best choice.

You can loop through the users in a given group by using table \System Documentation\Tables\UserGroupList and form a toAddress str (by adding the emails addresses with a seperator ; )