p*****s 发帖数: 1780 | 1 credit归于nkw。
用的gmail,手机号码的email大家网上去查。
用之前把emailfrom,emailto,emailcell,System.Net.NetworkCredential四行改一下。
另外端口587可能要开一下
$source = "http://www.shopping.hp.com/webapp/shopping/store_access.do?template_type=storefronts&landing=rts_tablet&category=rts_tablet&jumpid=in_R329_prodexp/hhoslp/accessories/top_banner/1/touchpad_accessories_top1_hp_touchpad_821"
$p = [regex]"Out of stock"
$p = [regex]"Coming soon"
$EmailFrom = "a*[email protected]"
$EmailTo = "a*[email protected]"
$EmailCELL = "1********[email protected]"
$Subject = "Notification HP"
$Body = "In stock or more than 3 items oos.."
$SMTPServer = "smtp.gmail.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("gmailuser
", "gmailpassword");
$wc = New-Object System.Net.WebClient
while (1 -eq 1) {
$html = $wc.DownloadString($source)
$m = $p.matches($html)
if ($m.Count -ne 2) {
echo "In stock or more than 3 items oos"
# TODO:发电子邮件,text给手机
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
$SMTPClient.Send($EmailFrom, $EmailCELL, $Subject, $Body)
}
else {
echo "Both out of stock"
}
Start-Sleep -s 60 #每60秒刷一次
} | a*******a 发帖数: 4212 | | e**********y 发帖数: 128 | 3 我在win7下得到如下错误:
In stock or more than 3 items oos
Exception calling "Send" with "4" argument(s): "The SMTP server requires a
secure connection or the client was not auth
enticated. The server response was: 5.5.1 Authentication Required. Learn
more at "
At line:7 char:25
+ $SMTPClient.Send <<<< ($EmailFrom, $EmailTo, $Subject, $Body)
+ CategoryInfo : NotSpecified: (:) [],
MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
【在 p*****s 的大作中提到】 : credit归于nkw。 : 用的gmail,手机号码的email大家网上去查。 : 用之前把emailfrom,emailto,emailcell,System.Net.NetworkCredential四行改一下。 : 另外端口587可能要开一下 : $source = "http://www.shopping.hp.com/webapp/shopping/store_access.do?template_type=storefronts&landing=rts_tablet&category=rts_tablet&jumpid=in_R329_prodexp/hhoslp/accessories/top_banner/1/touchpad_accessories_top1_hp_touchpad_821" : $p = [regex]"Out of stock" : $p = [regex]"Coming soon" : $EmailFrom = "a*[email protected]" : $EmailTo = "a*[email protected]" : $EmailCELL = "1********[email protected]"
| a9 发帖数: 21638 | 4 找个不用验证的smtp服务器,呵呵。
下。
【在 e**********y 的大作中提到】 : 我在win7下得到如下错误: : In stock or more than 3 items oos : Exception calling "Send" with "4" argument(s): "The SMTP server requires a : secure connection or the client was not auth : enticated. The server response was: 5.5.1 Authentication Required. Learn : more at " : At line:7 char:25 : + $SMTPClient.Send <<<< ($EmailFrom, $EmailTo, $Subject, $Body) : + CategoryInfo : NotSpecified: (:) [], : MethodInvocationException
| p*****s 发帖数: 1780 | 5 "gmailuser", "gmailpassword" 改了没有?
【在 e**********y 的大作中提到】 : 我在win7下得到如下错误: : In stock or more than 3 items oos : Exception calling "Send" with "4" argument(s): "The SMTP server requires a : secure connection or the client was not auth : enticated. The server response was: 5.5.1 Authentication Required. Learn : more at " : At line:7 char:25 : + $SMTPClient.Send <<<< ($EmailFrom, $EmailTo, $Subject, $Body) : + CategoryInfo : NotSpecified: (:) [], : MethodInvocationException
| l******a 发帖数: 3803 | 6
这两个要用单引号!
【在 p*****s 的大作中提到】 : "gmailuser", "gmailpassword" 改了没有?
| e**********y 发帖数: 128 | 7 我 改了。可能是楼下说得对,把双引号改成单引号。
不过貌似不需要,刚去bestbuy,买到了一个,哈哈。
【在 p*****s 的大作中提到】 : "gmailuser", "gmailpassword" 改了没有?
| z**h 发帖数: 382 | 8 XP下按lz的模板建了script,powershell运行之出来一个上下移动的空窗口,还是收不
到Email怎么回事?
【在 p*****s 的大作中提到】 : "gmailuser", "gmailpassword" 改了没有?
|
|