|
[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: |
Sub SendEmail(ByVal strFrom As String, ByVal strTo As String, _
ByVal strSubj As String, ByVal strDesc1 As String, ByVal strDesc2 As String, ByVal strDesc3 As String)
'*---------------- Send email to user ------------------*
From = strFrom
ToAddr = strTo
Subj = strSubj
'*---------------- body Information --------------------*
sComments1 = strDesc1
sComments2 = strDesc2
sComments3 = strDesc3
'create the mail message
Dim mail As New System.Net.Mail.MailMessage ' MailMessage()
Dim strBody As String = Body
'set the addresses
mail.From = New MailAddress(From)
mail.To.Add(ToAddr)
Dim strCC As String = Trim(ConfigurationManager.AppSettings("CCAddress").ToString)
If Not (strCC = "") Then
mail.CC.Add(strCC)
End If
mail.Priority = Net.Mail.MailPriority.High
'set the content
mail.Subject = Subj
'** add attachments
Dim newFileName As String = Nothing
Dim fStream As FileStream = Nothing
Dim fileType As String = Nothing
Dim fileSize As String = Nothing
Dim fileExt As String = ""
Dim i As Integer = 0
Dim fileNames As New ArrayList
Dim uploadedFiles As HttpFileCollection = Request.Files
Do Until i = uploadedFiles.Count
Dim userPostedFile As HttpPostedFile = uploadedFiles(i)
If userPostedFile.ContentLength > 0 Then
newFileName = System.Guid.NewGuid().ToString()
fileType = userPostedFile.ContentType
fileExt = Me.GetFileExtension(userPostedFile.FileName)
newFileName = newFileName + "." + fileExt
Dim numBytes As Integer = CInt(userPostedFile.InputStream.Length)
Dim buffer As Byte() = New Byte(numBytes - 1) {}
userPostedFile.InputStream.Read(buffer, 0, numBytes)
Dim FullPath As String = Server.MapPath(LOCAL_DIRECTORY) + "\" + newFileName
fileNames.Add(FullPath)
fStream = New FileStream(FullPath, FileMode.Create)
fStream.Write(buffer, 0, numBytes)
fStream.Close()
Dim attachmt1 As New System.Net.Mail.Attachment(FullPath)
mail.Attachments.Add(attachmt1)
End If
i += 1
Loop
' end attachments
'** first we create the Plain Text part
Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString("This is my plain text content, viewable by those clients that don't support html", Nothing, "text/plain")
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:companylogo><br><br>" & vbCrLf + sComments1 + "<br>" + sComments2 + "<br>" + "<br>" + "Problem or Service Description: " + "<br>" + sComments3 + "<br>" + "<br>" + "Your quick attention is appreciated:" + "<a href='http://" & Request.ServerVariables("HTTP_HOST") & "/Vaf/GMOApproval.aspx?id=" & "' ></a>" + " " + "<br>" + "<br>", Nothing, "text/html")
'** Get server Path
Dim path2 As String = Server.MapPath("~") & "\"
Dim filename As String = path2 & "images\img_default.png"
'** create the LinkedResource (embedded image)
Dim logo As New LinkedResource(filename)
logo.ContentId = "companylogo"
'** add the LinkedResource to the appropriate view
htmlView.LinkedResources.Add(logo)
'' ** add the views
mail.AlternateViews.Add(htmlView)
mail.AlternateViews.Add(plainView)
'** send the message
Dim strSMTPServer As String = ConfigurationManager.AppSettings("SMTPServer")
Dim smtp As New SmtpClient(Trim(strSMTPServer)) 'specify the mail server address
smtp.Send(mail)
'If mail.Attachments.Count > 0 Then
' For Each att As Attachment In mail.Attachments
' att.Dispose()
' Next
'End If
...
mail = Nothing
smtp = Nothing
|
Advertisement
| Hall of Fame |