Question : SMTP email  with CCs in VB.Net 2008

I have used bits and pieces of the solution provided by VBRocks  dated (09/15/08 04:03 PM, ID: 22483664).  The missing key is that I need to send a carbon copy of the email.  Please see the code snippet which is the basis of VBRocks code.  If someone could assist with the Carbon Copy option to work with the Code Snippet, I would appreciate it.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
'Set the HostName
        Dim host As String = "host name or ip address"
 
        'Set the email information
        Dim [From] As String = "[email protected]"
        Dim [To] As String = "[email protected]"
        Dim Subject As String = "test2"
        Dim Body As String = "Body"
 
        'Create a new MailMessage, specifying who it is From and who it is going To
        '  and set the Subject and Body
        Dim Email As New System.Net.Mail.MailMessage([From], [To])
        Email.Subject = Subject
        Email.Body = Body
   
        'Create a new SmtpClient
        Dim mailClient As New System.Net.Mail.SmtpClient()
        mailClient.Host = host
    
        Try
            'Attempt to send the email, show any exceptions below
            mailClient.Send(Email)
 
            MsgBox("Email Sent!")
        Catch ex As Exception
 
            MessageBox.Show("Unable to send email, because the following error has occurred:" & _
                vbCrLf & vbCrLf & _
                ex.Message, _
                "Error sending email", _
                MessageBoxButtons.OK, MessageBoxIcon.Error)
 
        End Try
 
        Email.Dispose()
        mailClient = Nothing
        GC.Collect()

Answer : SMTP email  with CCs in VB.Net 2008

CC is a collection, so you would use something like:

            Dim [cc] As System.Net.Mail.MailAddress = _
                          new System.Net.Mail.MailAddress("ccaddress@emailaddresses.com")
            Email.CC.Add([cc])

See: http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.cc.aspx
Random Solutions  
 
programming4us programming4us