Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 24th, 2007, 11:07 AM
Authorized User
Join Date: Jan 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default email- from web form

I am trying to add email functionality to my web form..first is SMTP a good option..what are the disadvantes,advantages.

Also I have the following piece of code that sends email to one person ,cc,bcc.
How can I modify it to send it to a distribution list.

// Construct a new mail message and fill it with information from the form
   MailMessage aMessage = new MailMessage();
   aMessage.From = FromTextBox.Text;
   aMessage.To = ToTextBox.Text;
   aMessage.Cc = CCTextBox.Text;
   aMessage.Bcc = BCCTextBox.Text;
   aMessage.Subject = SubjectTextBox.Text;
   aMessage.Body = MessageTextBox.Text;
// if an attachment file is indicated, create it and add it to the message
   if (AttachmentTextBox.Text.Length > 0)
      aMessage.Attachments.Add(new MailAttachment(AttachmentTextBox.Text, MailEncoding.Base64));

// Now send the message


catch(Exception ex)




Old July 24th, 2007, 11:29 AM
Authorized User
Join Date: Sep 2004
Location: Edegem, Antwerpen, Belgium.
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts


If you check the below link, you can see that the To, Cc and Bcc properties are from type MaillAddressCollection.


This means that you first need to create an instance of the MailAddressCollection, add the recipients to it and then assign it to the MailMessage.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Form Email Job Problem kwilliams ASP.NET 2.0 Professional 2 June 24th, 2008 02:27 PM
Web page email ashuphp Beginning PHP 1 April 19th, 2007 12:03 AM
set Focus to web control in Web form vivekshah C# 1 June 17th, 2006 03:25 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.