I would recommend handeling the body differently as well.
either load a text file and replace strings, use XML/XLST, or use a System.Text.StringBuilder object.
[tt]string x += ... [/tt]uses alot of resources that are not necessary.
If you know all the email addresses ahead of time (as well as subject, body, from address - which it looks like you do in this case) there is also an overloaded constructor you can use to create your MailMessage object. It takes a comma separated string of email addresses.
I would also use a string builder for the body, or better yet just type it all as one string, as it is not all that long (better to deal with those pesky _'s in VB than do a bunch of string appends or even use a string builder IMO).
For longer strings, or strings built more dynamically, Jason is spot on and you should look into using the StringBuilder class.
Hope this helps,
Alex
Ignorance of certain subjects is a great part of wisdom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.