M
Miguel Dias Moura
Hello,
Can you help me out in making this work? What I want is as simple as sending
form values to an email.
The code I am using is the following:
<Script runat="server">
Private Sub Page_Load()
Dim msg As EmailMessage = New EmailMessage("localhost")
Dim msgTo, msgFrom, msgName, msgSubject, msgMessage
msgTo = Request.Form("to")
msgFrom = Request.Form("from")
msgName = Request.Form("name")
msgSubject = Request.Form("subject")
msgMessage = Request.Form("message")
' Set the email type
msg.BodyFormat = MailFormat.Html
' Set the from address
msg.FromAddress = msgFrom
' Set the to address
msg.To = msgTo
' Set the from name
msg.FromName = msgFrom
' Set the email subject
msg.Subject = msgSubject
' Set the email message
msg.Body = "<html><head><style type='text/css'>body {font-family:
Verdana, Arial, Helvetica, sans-serif; font-size: 11px;color: #333333;
background-color: </style></head><body>" &_
"<strong>New Message</strong>" &_
"<br><strong>From: </strong>" & msgFrom &_
"<br><strong>Name: </strong>" & msgName &_
"<br><strong>To: </strong>" & msgTo &_
"<br><strong>Subject: </strong>" & msgSubject &_
"<br><strong>Message Text</strong>" &_
"<br> " & msgMessageField &_
"</body></html>"
' Internal Exceptions
msg.ThrowException = False
' Logging and LogBody
msg.Logging=false
msg.LogBody = false
' Sends Message
If msg.Send() Then
' Redirects to error page
Response.Redirect("status.aspx?result=contactErr")
Else
' Redirects to confirmed page
Response.Redirect("status.aspx?result=contactOk")
End If
End Sub
</script>
I really would appreciate if you could send me a working example using my
code. I am trying to make it work for 1 week and until now I had no luck.
The form has 5 text inputs: to, from, name, subject and message AND a button
which when pressed should send the form values in the email.
I tryied to comment everything I could think of. I am working in ASP.net /
VB.
Thank You Very Much,
Miguel Moura
Can you help me out in making this work? What I want is as simple as sending
form values to an email.
The code I am using is the following:
<Script runat="server">
Private Sub Page_Load()
Dim msg As EmailMessage = New EmailMessage("localhost")
Dim msgTo, msgFrom, msgName, msgSubject, msgMessage
msgTo = Request.Form("to")
msgFrom = Request.Form("from")
msgName = Request.Form("name")
msgSubject = Request.Form("subject")
msgMessage = Request.Form("message")
' Set the email type
msg.BodyFormat = MailFormat.Html
' Set the from address
msg.FromAddress = msgFrom
' Set the to address
msg.To = msgTo
' Set the from name
msg.FromName = msgFrom
' Set the email subject
msg.Subject = msgSubject
' Set the email message
msg.Body = "<html><head><style type='text/css'>body {font-family:
Verdana, Arial, Helvetica, sans-serif; font-size: 11px;color: #333333;
background-color: </style></head><body>" &_
"<strong>New Message</strong>" &_
"<br><strong>From: </strong>" & msgFrom &_
"<br><strong>Name: </strong>" & msgName &_
"<br><strong>To: </strong>" & msgTo &_
"<br><strong>Subject: </strong>" & msgSubject &_
"<br><strong>Message Text</strong>" &_
"<br> " & msgMessageField &_
"</body></html>"
' Internal Exceptions
msg.ThrowException = False
' Logging and LogBody
msg.Logging=false
msg.LogBody = false
' Sends Message
If msg.Send() Then
' Redirects to error page
Response.Redirect("status.aspx?result=contactErr")
Else
' Redirects to confirmed page
Response.Redirect("status.aspx?result=contactOk")
End If
End Sub
</script>
I really would appreciate if you could send me a working example using my
code. I am trying to make it work for 1 week and until now I had no luck.
The form has 5 text inputs: to, from, name, subject and message AND a button
which when pressed should send the form values in the email.
I tryied to comment everything I could think of. I am working in ASP.net /
VB.
Thank You Very Much,
Miguel Moura