B
bgreer5050
I have a form with the following fields:
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "(e-mail address removed)"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "(e-mail address removed)"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>