|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: |
<script runat="server">
Sub TiggerEmail(sender as Object, e as EventArgs) Handles MyBase.Load
SendMail (Request.Form("fname") + Request.Form("contacttime") + Request.Form("email") + Request.Form("phone"))
end sub
'QUESTION 1 - HOW TO GET MY FORM VALUES INTO THIS SUB
Private Sub SendMail(ByVal fname As String, ByVal phone As String, ByVal email As String, ByVal contacttime As String)
'Set the HostName
Dim host As String = "SMTP SERVER"
Dim ToEmail As String = "joe@joe.com"
Dim FromEmail As String = "bill@bill.com"
Dim Subject As String = "Contact submission"
'QUESTION 2 - HOW DO I GET THSE VALUES INTO THE BODY?
Dim body as string = "Name: " '& fname & " Phone: " & phone & " Email: " & email & " Contact Time: " & contacttime
Dim Result As String = ""
Dim Email As New System.Net.Mail.MailMessage(FromEmail, ToEmail)
Dim mailClient As New System.Net.Mail.SmtpClient(host)
mailClient.Host = host
'mailClient.EnableSsl = True
Email.Subject = Subject
Email.Body = body
'Dim port As Int32 = 465 ' WITH SSL
Dim port As Int32 = 80 ' NO SSL
Dim authenticationInfo As _
New System.Net.NetworkCredential( _
"username", _
"password")
mailClient.UseDefaultCredentials = False
mailClient.Credentials = authenticationInfo
Try
mailClient.Send(Email)
Result = "OK"
Catch ex As Exception
Response.Write("Unable to send email, the following error has occurred:" & vbCrLf & vbCrLf & _
ex.Message)
End Try
Email.Dispose()
mailClient = Nothing
Host = Nothing
GC.Collect()
End Sub
</script>
<BODY>
<table width="300px" height="200px">
<tr>
<td>
<!-- QUESTION 3 - How do I post back a message that says their submission went through? -->
<div>
<p>Your submission has been sent successfully.</p>
</div>
<form id="contactform" runat="server">
<div>
<asp:ValidationSummary
ID = "Summary"
runat = "server"
DisplayMode = "BulletList" /></div>
<div>First Name:
<asp:TextBox ID="fname" runat="server"></asp:TextBox></div>
<asp:RequiredFieldValidator
ID = "rfname"
runat = "server"
ControlToValidate = "fname"
ErrorMessage = "Name Required"
Display = "None" />
<div>Phone: Ex.(222-222-2222 x22)
<asp:TextBox ID="phone" runat="server"></asp:TextBox></div>
<asp:RegularExpressionValidator
ID = "regPhone"
runat = "server"
ControlToValidate = "phone"
Display = "None"
ErrorMessage = "Invalid Phone Number"
ValidationExpression= "((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}( x\d{0,})?" />
<div>Email address:
<asp:TextBox ID="email" runat="server"></asp:TextBox></div>
<asp:RegularExpressionValidator
ID = "regEmail"
runat = "server"
ControlToValidate = "Email"
Display = "None"
ErrorMessage = "Invalid Email"
ValidationExpression= "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
<div>
<asp:DropDownList ID="contacttime" runat="server">
<asp:ListItem Value="9am_12pm">9am-12pm</asp:ListItem>
<asp:ListItem Value="12pm_3pm">12pm-3pm</asp:ListItem>
<asp:ListItem Value="3pm_6pm">3pm-6pm</asp:ListItem>
</asp:DropDownList></div>
</div>
<asp:button id="btnSubmit" runat="server" OnClick="SendMail" Text="Submit" />
</form>
</td>
</tr>
</table>
</BODY>
|
Advertisement
| Hall of Fame |