MailMessage() in ASP 2.0 VB
-
I use this code snippet and it works fine Dim objMM As New MailMessage(strFrom, strTo, strSubject, strBody) Dim smtpClient As New SmtpClient("localhost") 'smtpClient.Timeout = 100 smtpClient.Send(objMM) But i want to send a BCC and the code for it should be objMM.Bcc = txtBcc.Text and executing this line i get the error BC30526: Property 'Bcc' is 'ReadOnly'. Does anyone have a solution
-
I use this code snippet and it works fine Dim objMM As New MailMessage(strFrom, strTo, strSubject, strBody) Dim smtpClient As New SmtpClient("localhost") 'smtpClient.Timeout = 100 smtpClient.Send(objMM) But i want to send a BCC and the code for it should be objMM.Bcc = txtBcc.Text and executing this line i get the error BC30526: Property 'Bcc' is 'ReadOnly'. Does anyone have a solution
If you look at the MailMessage.BCC property documentation, you can see a sample of adding a BCC address to the mail address collection. Pretty much you need to this,
Dim bccAddress As MailAddress = new MailAddress(txtBcc.Text) objMM.Bcc.Add(bccAddress)
~Javier Lozano