MSBuild.ExtensionPack.Communication.Email

Jul 22, 2011 at 8:27 PM

Hi,

I am having an issue with Email task.   I am trying to send a message to group of recepients.    When I send message to one person it works fine but sending it to a group it fails.   The message in email system (Outlook Exchange:  Your message can't be delivered because delivery to this address is restricted.   After speaking with Administrators they advised that to send messages to groups you must authenticate user.   This is what my task looks like:

<MSBuild.ExtensionPack.Communication.Email TaskAction="Send" 
                                               Subject="Email Subject"
                                               SmtpServer="smtp.myserver.com"
                                               MailFrom="teamfoundation@company.noreply"
                                               MailTo="groups@myemail.com"
                                               Body="Email Body"
                                               UseDefaultCredentials="false"
                                               UserName="username"
                                               UserPassword="password"
                                               
                                               />

Any ideas?

 

Coordinator
Jul 28, 2011 at 9:59 PM

I'm not an exchange expert, but I thought it would work with the current code which sets the credentials. I'll see what I can dig up...

 

                using (SmtpClient client = new SmtpClient(this.SmtpServer))
                {
                    if (this.Port > 0)
                    {
                        client.Port = this.Port;
                    }

                    client.EnableSsl = this.EnableSsl;
                    client.UseDefaultCredentials = this.UseDefaultCredentials;
                    if (!string.IsNullOrEmpty(this.UserName))
                    {
                        client.Credentials = new System.Net.NetworkCredential(this.UserName, this.UserPassword);
                    }

                    client.Send(msg);
                }
Mike