2014年1月13日 星期一

copy.com&工作排程器使用vbs引數&相對路徑與使用效能監視器監視硬碟空間

copy.com提供多個資料夾同步的功能,方法是將要同步的資料夾建立捷徑在copy資料夾內。
相對路徑是指執行程式的位置,不是vbs指向的程式位置,要注意。而在工作排程器中則必須設定開始位置來定義相對路徑。

NOTES:
“Any Directory” Syncing. Okay, we totally make up this name but it is exactly how it sounds. While Dropbox limits us to sync only files in a central folder (aptly named Dropbox), Copy.com lets you sync any directories on your computer. You can do this by creating a shortcut to that folder and place it within Copy directory. Not very intuitive like SugarSync though, which lets us do exact same thing within right-click menu.

Found a solution if any one is interested the only way it would take the parameters is by adding the path of the wscript to the scheduler to the run line in the scheduler. 
Although wscript is the default for vbs files the scheduler would still ignore the parameters. 
So to get it working the run text in the scheduler should be:

C:\WINDOWS\system32\wscript.exe C:\TASKS\test.vbs one two

I am not sure why this works when other methods dont but I have read that parameters are only passed to .exe files so this may be why they are ignored for .vbs files.

Thanks for the help from KrisSimonis & dglienna.


  • Telnet is an extremely limited tool. A much better utility would be sc.exe (http://www.securityfocus.com/data/tools/nc11nt.zip). In a batch file you could use it like so:
    @echo off
    nc -z 81.6.53.245 1724
    if %ErrorLevel% EQU 0 (echo Port is open) else (echo Port is not open)
    While you could embed nc.exe in a VB Script file, this only complicates the matter.
    Alternatively, if you run Windows 7, portqry.exe could do a similar job.
    • Marked as answer by zsustar Thursday, July 29, 2010 8:11 AM
    Thursday, July 29, 2010 5:43 AM
    Avatar of Forest brook
    (MCC)
    19,605 Points
  • Portqry is helpful to my case because the parameter -q will
    returns 0 if port is listening
    returns 1 if port is not listening
    returns 2 if port is listening or filtered 
    And i draft a script as following~
    ***************
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Return = WshShell.Run("PortQry.exe -nwww.google.com -p tcp -e 80 -q", 1, true)
    WScript.Echo Return
    *****************
    It's cool. Thank you Peqasus.
    BTW, nc.exe is not working, maybe it's killed by my Norton. Anyway i prefer the tools from MS in term of security control.


會要這個功能,是因為我朋友反應說。硬碟空間不夠,就是要再買大容量的硬碟來換。但總不能等到磁碟空間都滿了才發現吧?所以,只好上網找一下 Solution 囉!
因為之前已經做過利用 MailSend 這支小程式來發信,現在只要能夠找到觸發執行批次檔的方式就行了。
上網看了有用 Power ShellVBScript 來做的,不過,我想我還是兜一下好了。所以,就利用「效能監視器」的「警示」功能囉!
第一個動作,當然是先寫一下 batch 檔囉!因為我有切三個磁區,所以就分別監控囉!先利用 psinfo.exe -d 來檢視各磁碟的狀況。
因為對 Linux 比較熟,所以就習慣用剩餘空間百分比來做觸發條件囉!但因為三個磁區的容量差異還蠻大的,經換算後,就以空間剩 85%90%97% 來做為觸發條件。
列一下我所寫的 batch 檔:
echo Volume Type  Format     Label                            Size            Free          Free > C:\sch\alarmhdd_c.txt
C:\pstools\psinfo.exe -d |find "C: Fixed" >> C:\sch\alarmhdd_c.txt
rem 郵件標題:伺服器C磁碟使用率達 85%
C:\sch\mailsend -d msa.hinet.net -smtp mail.domain.com.tw -t admin@domain.com.tw -f hddcheck@hinet.net -sub "=?UTF-8?B?5Ly65pyN5Zmo77yj56OB56Kf5L2/55So546H6YGUIDg177yF?=" -m C:\sch\alarmhdd_c.txt
因為 E-Mail 主旨有中文,怕有編碼上的問題,就利用網路上有線上轉換 Base64 的網頁,進行 Base64 編碼的動作。
收到信的內容就大概如下:

(這是測試用的,所以在未達 85% 也會寄發)
接下來就是到「效能監視器」的「警示」來進行「新增警示設定」的動作。
輸入一個警示名稱,本例為「DriveCAlarm」。
在「註解」欄位寫入說明,再按下「新增」鈕。
依照下列的圖示進行「計數器」項目的挑選,完成後按下「新增」鈕,再按「關閉」鈕。
計數器欄位已經設定好了,接下來就是設定觸發條件。我對C磁區的設定為可用空間小於 5.86GB 就發出告警,1天檢查1次。
切換到「執行」頁籤,除了預設勾選的第一項外,再勾選「執行以下程式」。按下「瀏覽」鈕,挑選要執行的 Batch 檔,本例為:C:\sch\DriveCAlarm.bat
按下「套用」鈕後,會出現「設定密碼」的視窗,使用者欄位格式要為「Domain\User」。
確認一下「執行身分」是為之前所設定的「Domain\User」。
這樣子「警示」功能就多了一項設定。如果未啟動,就將它啟動。有問題的話,就到事件檢視器看看訊息。
為了要測試設定是否可運作?所以進行了下列的修改來確認。
在事件檢視器中,就可以看到類似下面的事件訊息。當然也會收到 E-Mail
大功告成,記得要將觸發條件改回來,要不然信就收不完啦!DE 磁區的設定也依樣畫葫蘆即可。


[Tip]使用效能監視器監控伺服器狀態,並寄送異常通知

  
當我們在管理伺服器時,常常會希望能監控伺服器狀態, 如果伺服器發生CPU持續過高,或是硬碟空間不足時能夠發出異常通知, 我們可以透過Windows內建的效能監視器來簡單實現這樣的功能。

設定效能監視器異常界線

在這邊以監控硬碟有效空間來做為範例。
  1. 首先打開我們的效能監視器,新增資料收集器集合工具
  2. 輸入名稱"伺服器效能監控",選擇使用手動建立
  3. 選擇"效能監視器警訊
  4. 我們可以看到已經出現了這個資料收集器集合
  5. 接下來開始新增我們的監控項目,新增一個資料收集器
  6. 輸入硬碟空間監控,並選擇效能計數器警訊
  7. 點選新增,選擇監控項目
  8. 選擇Logical Disk的% Free space,新增要監控的磁區
  9. 設定在20%以下時觸發警訊
  10. 勾選設定警訊內容

設定效能監視器警訊執行動作

  1. 設定抽樣間格為2分鐘 (普通應該一小時即可)
  2. 點選警訊動作頁籤,勾選在事件紀錄檔紀錄
  3. 設定發生異常時執行排程及通知訊息,點選右邊小箭頭可以瀏覽可使用的變數

設定發送警訊通知排程

  1. 進入工作排程器,新增排程工作
  2. 設定執行帳號,選擇不論是否登入都執行
  3. 點選動作頁籤,選擇新增
    當伺服器發生異常時,
  4. 輸入寄送email的資訊,$(Arg0)會自動帶入從效能監視器剛剛設定的警訊文字
  5. 設定完成,當伺服器異常時就會收到通知的Email了
※註: 使用內建的傳送電子郵件,僅支援不需驗證的SMTP Server, 此處可自由置換其他的警訊通知方法 (ex.Powershell) 只要記住可使用$(Arg0)來讀取帶入的警訊內容即可

總結


透過效能監視器,我們可以根據自己的需要實現簡單的伺服器監控機制, 當然隨著伺服器數量越來越多,可以按照需求使用更好的解決方案, 這邊提供大家一個簡單且輕量級的伺服器監控方法, 關於今天的內容,若有任何問題歡迎大家提出來一起討論!

參考資料
http://olivetjournal.com/my-honest-copy-com-review#proreviewhttp://forums.codeguru.com/showthread.php?439916-How-to-run-a-very-long-SQL-statementhttp://social.technet.microsoft.com/Forums/scriptcenter/en-US/37c5fced-38e4-4508-82a3-7e59cafce46f/how-to-use-vbscript-to-check-telnet-result?forum=ITCG

http://blog.xuite.net/jyoutw/xtech/62155589
http://www.dotblogs.com.tw/kirkchen/archive/2012/11/24/use-performance-monitor-to-monitor-server-and-send-alert-email.aspx


Xpath, xml 轉成http並且擷取需要的nodes, unicode編碼問題,vba轉vbs, bat讀入變數,篩選及比對

使用Xpath抓取xml內的資料

Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
            objXMLHTTP.Open "Get", "xml網址", False
                objXMLHTTP.setRequestHeader "Content-Type", "text/xml"
                  objXMLHTTP.setRequestHeader "charset", "UTF-8"
                    objXMLHTTP.Send

        testXML = objXMLHTTP.responseText

        Set objXMLHTTP = Nothing

        接著要注意的是XPath 2.0要加上第二行否則有些語法不能使用

        Set xmldoc = CreateObject("MSXML2.DOMDocument")
                xmldoc.setProperty "SelectionLanguage", "XPath"
                
                xmldoc.LoadXML (testXML)

        Count node數量

        Set Root = xmldoc.DocumentElement.SelectSingleNode("篩選條件")
                  
                 xmlcount = xmldoc.DocumentElement.SelectNodes("篩選條件").Length

        接著篩選的方法
        格式是路徑//channel/item/title[(contains(.,'條件')],左式是指篩選符合條件的title層級,須注意路徑要依照xml內的格式填寫,並且可以使用and和or

        如果需要新增或開啟檔案需要呼叫檔案系統物件

        Set objfso = CreateObject("Scripting.FileSystemObject")

        我在寫的時候遇到亂碼的問題,因此調用ADODB.Stream

        Set objtextfile = CreateObject("ADODB.Stream")

                        objtextfile.Charset = "utf-8"
                        objtextfile.Open
                        objtextfile.LoadFromFile ("檔案路徑")

        寫入檔案時使用

        objtextfile.writetext xmldoc.DocumentElement.SelectNodes("篩選條件").Item(i).text + Chr(13) + Chr(10)

        + Chr(13) + Chr(10)是換行的意思

        另外如果要比對字串

        Set d = CreateObject("Scripting.Dictionary")

        Do Until objtextfile.EOS
                        arr = objtextfile.ReadText(-2)
                        d.Add arr, arr
                        Loop

        EOS是讀到檔案結尾,然後將objtextfile的內容寫入Dictionary d內
        最後如果比對Dictionary跟檔案有不同的時候寫入檔案

        If Not d.Exists(Cel) Then
        fs.writetext
        end if

        bat讀入每行變數,使用%%a

        for /f %%a in (檔案.txt) do (動作,將輸入變數用%%a替代)

        參考資料
        Xpath, xml 轉成http並且擷取需要的nodes
        http://www.blueshop.com.tw/board/FUM200410061525290EW/BRD2011041810155910R.html
        http://bytes.com/topic/xml/answers/895475-how-do-i-get-value
        http://bbs.csdn.net/topics/360192227
        http://www.w3school.com.cn/xml/xml_to_html.asp
        http://michaelbaidotnet.blogspot.tw/2012/05/xpathxml-xmldocument-xmlnode-xml.html
        http://stackoverflow.com/questions/247135/using-xpath-to-search-text-containing
        http://stackoverflow.com/questions/3655549/xpath-containstext-some-string-doesnt-work-when-used-with-node-with-more
        http://www.pin5i.com/showtopic-23231.html
        http://zhidao.baidu.com/question/494955221.html
        http://web2.tcssh.tc.edu.tw/teacher/cjwu/vb/newvb6/new0g05.html
        http://msdn.microsoft.com/zh-tw/library/1k5e45de(v=vs.90).aspx
        http://stackoverflow.com/questions/7986679/classic-asp-not-recognizing-xpath-contains-function
        http://stackoverflow.com/questions/17049535/vbscript-taking-xml-node-values-and-assigning-to-variables
        http://stackoverflow.com/questions/14469414/xpath-selecting-same-level-node-with-different-name
        http://stackoverflow.com/questions/3139402/how-to-select-following-sibling-xml-tag-using-xpath
        unicode編碼問題
        http://www.blueshop.com.tw/board/show.asp?subcde=BRD20110626172457CS9&fumcde=FUM200501271723350KG&odr=cdt&odrtyp=0
        http://www.dotblogs.com.tw/rainmaker/archive/2011/05/17/25261.aspx
        http://stackoverflow.com/questions/2524703/save-text-file-utf-8-encoded-with-vba
        http://tw.knowledge.yahoo.com/question/question?qid=1607092206104
        vba轉vbs
        http://www.asjh.tn.edu.tw/xupload/learning/vbscript/vbs16.htm
        http://www.visualbasicscript.com/Vbscript-to-read-txt-file-for-input-m31649.aspx
        http://www.itworld.com/nl/win_this_wk/04282003
        http://www.visualbasicscript.com/m57228-print.aspx
        http://mikenation.net/files/backupprintservers.txt
        bat讀入變數
        http://www.dotblogs.com.tw/chhuang/archive/2012/06/09/72702.aspx
        rss feed在chrome顯示亂碼
        http://blog.hsdn.net/1388.html
        讀入字串亂碼使用ADODB.Stream解決
        http://baike.baidu.com/view/1806836.htm
        http://www.lotusfans.com/forum/archive/index.php/t-43645.html
        http://stackoverflow.com/questions/15151128/read-large-file-line-by-line-with-ado-stream
        http://stackoverflow.com/questions/13851473/read-utf-8-text-file-in-vbscript

        sendemail.exe發送html格式郵件

        這是google的頁庫存檔,連結已無法存取,留個紀錄。

        本文主要讨论Python如何使用sendEmail发(垃圾)邮件?
             Linux用户常用sendmail发送电子邮件,当您看了本文后可能会改用sendEmail去发送邮件了,呵呵。

        1 下载sendEmail

               sendEmail有Linux和windows版本软件包,依据自己的平台选择下载好了
              登录上边的网址找到:
           

             Download

        Official Release: sendEmail-v1.56.tar.gz    (29kb Sep 29th, 2009)    Changelog    Screen Shot

        Windows Download:
        Free sendEmail.exe for Windows. To use simply run sendEmail.exe from a console / command line.
        sendEmail-v156-notls.zip   (677kb Sep 29th, 2009)   No TLS support 
        sendEmail-v156.zip   (1.4mb Sep 29th, 2009)   TLS supported 

        RPM Package: sendEmail rpm
        选择适合自己的下载好了

        2 安装sendEmail

          sendEmail不需要安装直接解压到某目录即可直接使用。
            (Linux用户) tar -zxvf sendEmail-x-y-z.tar.gz
         本文选择windows平台sendEmail软件包,下载后解压到c:\sendEmail目录下。


        3 sendEmail命令帮助

           sendEmail软件是命令行软件,需要在Dos(shell)下执行使用。

        [jeapedu]# sendEmail --help
        
        sendEmail-1.56 by Brandon Zehm <caspian@dotconf.net>
        
        Synopsis:  sendEmail -f ADDRESS [options]
        
        Required:
        -f ADDRESS                from (sender) email address
        * At least one recipient required via -t, -cc, or -bcc
        * Message body required via -m, STDIN, or -o message-file=FILE
        
        Common:
        -t ADDRESS [ADDR ...]     to email address(es)
        -u SUBJECT                message subject
        -m MESSAGE                message body
        -s SERVER[:PORT]          smtp mail relay, default is localhost:25
        
        Optional:
        -a   FILE [FILE ...]      file attachment(s)
        -cc  ADDRESS [ADDR ...]   cc  email address(es)
        -bcc ADDRESS [ADDR ...]   bcc email address(es)
        -xu  USERNAME             username for SMTP authentication
        -xp  PASSWORD             password for SMTP authentication
        
        Paranormal:
        -b BINDADDR[:PORT]        local host bind address
        -l LOGFILE                log to the specified file
        -v                        verbosity, use multiple times for greater effect
        -q                        be quiet (i.e. no STDOUT output)
        -o NAME=VALUE             advanced options, for details try: --help misc
        -o message-content-type=<auto|text|html>
        -o message-file=FILE         -o message-format=raw
        -o message-header=HEADER     -o message-charset=CHARSET
        -o reply-to=ADDRESS          -o timeout=SECONDS
        -o username=USERNAME         -o password=PASSWORD
        -o tls=<auto|yes|no>         -o fqdn=FQDN
        
        Help:
        --help                    the helpful overview you're reading now
        --help addressing         explain addressing and related options
        --help message            explain message body input and related options
        --help networking         explain -s, -b, etc
        --help output             explain logging and other output options
        --help misc               explain -o options, TLS, SMTP auth, and more

              测试用例

             我(sender@163.com)要给他/她(receiver@sina.com)发电子邮件,邮件的主题是"subjectTitle",邮件的内容是说句“hello”,带了附件attach.txt文件,我邮箱sender@163.com的密码是“123456”,则使用sendEmail的命令如下:
         sendEmail -f sender@163.com -t receiver@sina.com -s smtp.163.com -xu sender@163.com -xp 123456 -u subjectTitle -m hello -a attach.txt
                  注:本示例在windows平台下测试,需手动使用dos即运行->cmd->cd c:/sendEmail目录(假设下载文件解压到本目录)

           -f    后指定在邮箱里显示谁发的邮件
           -t    后指定发给谁
           -s   指定发送smtp服务器,本例用163的smtp服务器
           -xu 后需指定smtp服务器上的授权帐号(sender@163.com),
                 实际上就是用参数xu后边的邮箱来真正发送邮件
           -xp 后则是smtp服务器上的授权帐号(sender@163.com)所对应的密码,
                 smtp服务器要检查合法性
           -u   邮件主题
           -m  邮件正文内容
           -a   邮件携带附件(attach.txt)
              各位网友在自我测试时,需对应替换。比如想用“se@163.com(密码abcdef)”发邮件给"re@sina.com",邮件主题“hello”,邮件内容"world",携带附件"b.txt",我来替换一下如下:
         sendEmail -f se@163.com -t re@sina.com -s smtp.163 -xu se@163.com -xp abcdef -u hello -m world -a b.txt



        4 编写发送邮件程序

            写个Python程序来用用吧:发几百封邮件给他/她/Ta.程序名sm.py,请保存在sendEmail.exe同一目录下。
        import os
        
        from = "sender@163.com"
        to = "reveiver@sina.com"
        subject = "say hello"
        msg = "I like you"
        attachfile = "a.txt"
        c = 0
        while c < 498:
         os.system("sendEmail.exe -f "+from+" -t "+to+" -xu "+from+" -xp 123456 -u "+subject+" -s smtp.163.com -a "+attachfile+" -m "+msg)
         c = c + 1
            据说163邮件一天最多发500封信,之后。。。呵呵,何时解封时间不确定,我看可以多申请几个163邮箱。
            在sendEmail目录下执行python sm.py即可发499封邮件给他/她/Ta.

        5. 怎样使发送邮件内容为Html的呢?

            首先在sm.py文件所在目录下创建一个html文件,例如a.html,代码如下:

        <html>
        <body>
        <B>测试网页</B><br>
        <a href= "http://www.csdn.net"><font color = 'blue' size = '7'><u>CSDN就是牛!</u></font></a>
        </body>
        </html>

            接着,需要在sendEmail命令行里增加几个可以发送html文本作为邮件正文内容的参数选项。

             -o message-content-type=html 
             -o message-charset=CHARSET 
             -o message-header=HEADER  
             -o message-file=afile
        
             -o message-content-type = html 
                         告诉邮件服务器发送的是html格式邮件内容
             -o message-charset = CHARSET 
                        这里不能用utf-8否则邮件内容显示乱码
             -o message-file=某文件  
                        是用来指定携带的那个html网页文件作为邮件正文, 这样邮件正文里就可以有超级链接了。

             最后运行测试。


        參考資料

        es檔案瀏覽器無法開啟網路芳鄰問題

        發現es檔案瀏覽器突然無法開啟本來可以開啟的區網上的電腦,研究了一下發現是ipv6的問題,因為之前把路由器設定了v4 to v6 tunnel的功能,可能因此造成android無法map v4 ip。將ipv6關閉就回復正常。

        參考資料
        自己測試結果

        ubuntu virtualbox 共用資料夾 plexWatch, splashtop streamer, xrdp on ubuntu 13.10

        接續上篇使用ubuntu設定plexwatch web時也遇到一些問題,整理如下。

        • virtualbox共用資料夾位置在/media
          • 需要先將使用者加入群組
          • virtualbox預設為vboxsf
          • 終端機輸入指令sudo gpasswd -a 使用者帳號 vboxsf
        • 在設定crontab工作時不要輸入使用者名稱
        • twitter則需填入consumer_key, consumer_secret, access_token, access_token_secret四項,並且create my access token
        • ubuntu軟體中心位置 /usr/bin/software-center
        • remotebox不知為何無法成功使用,使用phpvirtualbox取代
        • virtualbox如果要使用遠端控制(非windows內建的遠端桌面)則需安裝extension pack
        • xrdp如果遇到灰色畫面無法進入則輸入以下指令,原因是gnome更動了設定
          • sudo apt-get install xrdp
          • sudo add-apt-repository ppa:xubuntu-dev/xfce-4.10
          • sudo apt-get update
          • sudo apt-get install xfce4
          • echo xfce4-session >~/.xsession  
        • ubuntu上使用splashtop streamer需要輸入以下指令否則目前無法使用於13.10(官方尚未支援)
          • sudo apt-get install aptitude
            sudo aptitude update
            sudo aptitude safe-upgrade
          • python /opt/splashtop-streamer/SRStreamer.pyc
          • sudo aptitude install python-appindicator

        參考資料
        共用資料夾權限
        http://ubuntuforums.org/showthread.php?t=1921707
        http://www.mobile01.com/topicdetail.php?f=300&t=3122670
        plexWatch on ubuntu
        http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
        https://github.com/ljunkie/plexWatch/blob/master/README.md
        crontab
        sudo gedit /etc/cron.d/anacron
        http://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job
        xrdp 灰畫面
        http://c-nergy.be/blog/?p=4448
        http://askubuntu.com/questions/266271/xubuntu-12-04-desktop-grey-with-no-icons
        plexWatch email notification
        https://forums.plex.tv/index.php/topic/72552-plexwatch-plex-notify-script-send-push-alerts-on-new-sessions-and-stopped/
        ubuntu splashtop streamer on 13.10
        https://support-splashtoppersonal.splashtop.com/entries/30097576-Splashtop-Streamer-on-Ubuntu-13-10
        http://qiita.com/nyarla/items/4202ddb8e29e2d0ddd65
        http://timothyandrewbarber.blogspot.tw/2011/02/finding-config-folder-in-ubuntu.html
        RemoteBox
        http://knobgoblin.org.uk/downloads.cgi
        http://www.openfoundry.org/tw/foss-programs/8319--virtualbox-remotebox
        http://www.ibm.com/developerworks/cn/linux/l-cn-remotebox/
        http://www.openfoundry.org/tw/foss-programs/8319--virtualbox-remotebox
        phpvirtualbox
        http://www.arthurtoday.com/2011/11/windows-phpvirtualbox.html#.Usl3t_QW2tQ
        http://blog.segmentfault.com/jifei/1190000000346904
        vboxwebsrv.exe
        https://forums.virtualbox.org/viewtopic.php?f=6&t=38449
        http://nikolas.demiridis.gr/post/10280216759/how-to-run-vboxwebsrv-as-a-service-on-windows-2008
        virtualbox rdp extension pack
        http://www.virtualbox.org/manual/ch07.html#vbox-auth
        ubuntu切換2D
        http://www.mobileai.tw/2013/01/08/ubuntu-12-10-2d/
        PlexWatch ip address必須與PMS在同一台電腦上(localhost)才可正常抓取
        https://forums.plex.tv/index.php/topic/72552-plexwatch-plex-notify-script-send-push-alerts-on-new-sessions-and-stopped/page-21#entry483408


        The locale codeset (cp1252) isn't one that perl can decode, stopped at Encode/Locale.pm line 94.

        使用plexwatch web時出現標題的錯誤,查詢了一下發現是程式本身從linux轉換到windows時沒有轉換好,向作者反映他說沒時間處理,於是只好自力救濟。到控制台-地區及語言-系統管理-非unicode程式的語言-變更系統地區設定改成英文(美國)可以解決問題,但是會產生後遺症就是其他程式可能出現亂碼無法閱讀。因此最後我的解決方式是再建立一個VM-ubuntu來使用。

        參考資料
        http://forge.fusioninventory.org/issues/2197
        http://contest-start.blogspot.tw/2009/12/apache-22-php531-mysql.html
        http://www.luar.com.hk/flashbook/archives/001425.php
        http://www.perlmonks.org/?node_id=981095
        http://www.php5.idv.tw/html.php?mod=article&do=show&shid=39
        http://blog.linym.net/archives/264
        http://idaiwan.pixnet.net/blog/post/28156513-apache-%E5%8A%A0-php-%E5%AE%89%E8%A3%9D%E9%85%8D%E7%BD%AE%E6%95%99%E5%AD%B8%EF%BC%88windows%EF%BC%89
        http://forums.adobe.com/message/2869206
        http://www.luar.com.hk/flashbook/archives/001425.php
        http://www.digglife.cn/articles/pp-the-locale-codeset-is-not-one-that-perl-can-decode.html

        Gmail信件被截斷

        使用sendemail.exe時發現寄出的mail被截斷,研究了一陣子,使用別的email地址卻沒事,所以應該是gmail的問題,大於16KB就會被截斷。後來嘗試了blat(不支援SSL),然後最後使用mailsend這支小程式,成功解決問題。我想問題大概是sendemail這支程式被判定限制?或者是跟使用base64有關。

        參考資料
        http://productforums.google.com/forum/#!topic/gmail-zh-tw/ViedeYzoF8A
        http://productforums.google.com/forum/#!topic/gmail/3dZE6kjwYpA
        http://ihower.tw/blog/archives/3481
        gmail大量寄件者指南
        https://support.google.com/a/answer/81126?hl=zh-Hant
        https://support.google.com/mail/answer/180707
        https://support.google.com/mail/answer/2451690
        jave.replace
        http://repeat.tw/blog/post/25800355-javascript-.replace()-%E7%9A%84%E7%AD%86%E8%A8%98
        測試垃圾郵件程度
        http://www.brandonchecketts.com/emailtest.php
        mailsend
        https://code.google.com/p/mailsend/wiki/ChangeLog
        http://community.spiceworks.com/topic/265337-how-to-send-email-from-command-line-in-windows-7
        base64decode
        http://www.convertstring.com/zh_TW/EncodeDecode/Base64Decode
        phpmailer
        http://blog.jsdan.com/php-%E4%BD%BF%E7%94%A8phpmailer%E9%80%8F%E9%81%8Egmail%E5%AF%84%E4%BF%A1/