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
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