Using CDO.Message - ReadOnly errors

C

CSINVA

I'm trying to resolve some error message I'm getting from this code:

Property "To" is "ReadOnly"
objEmail.To = sUserEmail

Proeprty "CC" is "ReadOnly"
objEmail.CC = pUserEmail


---- CODE--------

Protected Sub SendEmail(ByVal sender As Object, ByVal e As
System.EventArgs)

'Send email to sUserID email address from database
Dim sUserEmail As String
sUserEmail = txtsEmailAddress.Text

Dim pUserEmail As String
pUserEmail = txtEmail.Text

'Build Email Message
Dim sMsg As String
sMsg = (txtFname.Text & " " & txtLname.Text & "has requested
information about our web site" & vbCrLf & _
"Here is the contact information they provided:" &
vbCrLf & vbCrlf & _
"First Name: " & txtFname.Text & vbCrlf & _
"Last Name: " & txtLname.Text & vbCrlf & _
"Email Address: " & txtEmail.text & vbCrlf & _
"Email Type: " & ddlEmailType.SelectedItem.Text &
vbCrlf & _
"Telephone: " & txtTelephone.text & vbCrlf & _
"Country: " & ddlEmailType.SelectedItem.Text & vbCrlf &
_
"State: " & ddlState.SelectedItem.Text & vbCrlf & _
"City: " & txtCity.Text & vbCrlf & _
"Zip: " & txtZip.Text & vbCrlf & _
"TimeZone: " & ddlTimeZone.SelectedItem.Text & vbCrlf &
_
"Time To Call: " & ddlTimeToCall.SelectedItem.Text &
vbCrlf & _
"Day To Call: " & ddlDayToCall.SelectedItem.Text &
vbCrlf

Dim objEmail As New MailMessage()
objEmail.To = sUserEmail
objEmail.From = sUserEmail
objEmail.CC = pUserEmail
objEmail.Subject = "Pluginforsuccss - Information
Confirmation"
objEmail.Body = sMsg
objEmail.Priority = MailPriority.High
objEmail.IsBodyHtml = False

Try
Dim SmtpMail As New SmtpClient
SmtpMail.Send(objEmail)
Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
End Try

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top