CC not working in SMTP code


Aug 13, 2014
Programming Experience

In the following code, the Webmaster receives the sender's email, but his assistant, who should be copied in (CC) does not. Instead, what is happening is that the person who should be copied in, well his email address appears under CC in the Webmaster's inbox, but he does not receive the message in his own inbox.

There are no server errors.

The code looks like this, but there must be something wrong with the CC (and BCC) part of the code.

 Protected Sub SendEmail_Click(sender As Object, e As System.EventArgs)
        Dim myMessage As New MailMessage
        Dim Smtpserver As New SmtpClient
        Dim user_name As String = Request.Form("user_name")
        Dim user_email As String = Request.Form("user_email")
        Dim user_subject As String = Request.Form("user_subject")
        Dim user_message As String = Request.Form("user_message")
        Dim CC As MailAddress = New MailAddress("")
        Dim BCC As MailAddress = New MailAddress
        myMessage.From = New MailAddress(user_email) 'User's email
        myMessage.To.Add(New MailAddress("")) 'Webmaster
        myMessage.CC.Add(New MailAddress("")) 'Webmaster's assistant
        myMessage.Bcc.Add(New MailAddress("user_email")) 'blind copy to user's email address
        myMessage.Subject = user_subject
        myMessage.Body = user_message
        myMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
        myMessage.IsBodyHtml = True
        myMessage.Priority = MailPriority.Normal
        Smtpserver.DeliveryMethod = SmtpDeliveryMethod.Network
        Smtpserver.Host = ("mail.server")
        Smtpserver.Port = 25
        Smtpserver.EnableSsl = False
        Dim basicAuthenticationInfo As New System.Net.NetworkCredential("", "password")
        Smtpserver.Credentials = basicAuthenticationInfo
        myMessage = Nothing
       Smtpserver = Nothing

  End Sub
Thank you for any advice.
Top Bottom