|
[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. |
||
| 10/19/2009 at 09:00AM PDT, ID: 24823972 |
|
[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: |
#copy the file Over
gc "C:\Program Files (x86)\sms\sms_recv.log" | where {$_ -ne ""} > sms_rcv.csv
# Convert from UTC to this time zone (offset in hours)
$TimeZoneOffset = -5
# Load the last weeks messages from file
$FileName = "E:\count\sms\sms_rcv.csv"
$Messages = Import-CSV $FileName | Select-Object `
@{n='DateTime';e={ ([DateTime]"$($_.Date) $($_.Time)").AddHours($TimeZoneOffset) }}, `
Sender, Recipient, Status, Message, Details | `
Where-Object { $_.DateTime -gt (Get-Date).Date.AddDays(-7) }
# White List Filtering
$WhiteList = Import-CSV "white_list.csv"
# Select all fields from $Messages and add a Known field.
# Set Confirmed if phone number followed by a space exists in white list
# digits before the phone number are ignored (such as area / country codes)
$Messages = $Messages | %{
$Message = $_.Message
$WhiteListEntry = $WhiteList | ?{ $Message -Match "$($_.PNumbers)\s" }
$_ | Select-Object *, `
@{n='Known';e={ If ($WhiteListEntry) { "White-listed" } else { "Not White-listed" } }}, `
@{n='Number';e={ $WhiteListEntry.PNumbers }}
}
# Add the URL column
$Messages = $Messages | Select-Object *, `
@{n='URL';e={
$Matches = $Null
[Void]($_.Message -Match "(https?://)?([A-Za-z0-9\-]{2,64}\.)+[A-Za-z]{2,6}")
If ($Matches) { $Matches[0] }
}}
# Generate the report
$Subject = "Last week there were $($Messages.Count) Items"
# The image at this path will be embedded into the message
$ImagePath = "E:\count\sms\logo1.jpg"
# Create the CSS Header
$Header = "<style>table {font-size: 10pt; font-family: calibri;}
body {background-color:black;}
table {align: cernter; border-width: 1px;border-style: solid; border-color: black; border-collapse: collapse;}
th {font-size:1em; border-width: 1px;padding: 2px; border-style: solid; border-color: white; background-color: pink}
td {font-size:0.8em; border-width: 1px;padding: 2px; border-style: solid; border-color: white; background-color: green}
</style>"
# Body (inserted above the HTML table)
$Body = "<h2><img src=cid:Logo />SMS Item Detailed Report ($Subject).</h2>"
# Smtp details
$SmtpServer = "localhost"
$From = "sender@domain"
$To = "rcpt@domain.com"
# Generate the full message body from the report
$MessageBody = $Messages | ConvertTo-Html -Head $Header -Body $Body
# Create the mail message
$MailMessage = New-Object Net.Mail.MailMessage($From, $To)
$MailMessage.Subject = $Subject
$MailMessage.IsBodyHtml = $True
# Create a linked resource to store the image
$LinkedResource = New-Object Net.Mail.LinkedResource($ImagePath, "image/jpeg")
$LinkedResource.ContentId = "Logo";
# Create an Html view and add the linked resource
$HtmlView = [Net.Mail.AlternateView]::CreateAlternateViewFromString($MessageBody, "text/html")
$HtmlView.LinkedResources.Add($LinkedResource)
# Add the view to the message
$MailMessage.AlternateViews.Add($HtmlView)
# Send the mail
(New-Object Net.Mail.SmtpClient($SMTPServer)).Send($MailMessage)
|
Advertisement