2015年4月30日 星期四

測試 mail server是否可以正常寄信

測試 mail server是否可以正常寄信

開啟dos模式
c:>telnet 10.88.1.40 25
220 mis1.kitty.com.tw ESMTP Sendmail 8.13.8/8.13.8; Thu, 30 Apr 2015 15:57:24 +
0800
HELO aaa
250 mis1.kitty.com.tw Hello [10.88.1.41], pleased to meet you
MAIL FROM:aaa@bbb.com
250 2.1.0 aaa@bbb.com... Sender ok
RCPT TO:franco@kitty.com.tw
250 2.1.5 franco@kitty.com.tw... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
aaa
bbb
aaa
.
250 2.0.0 t3U7vO3i028823 Message accepted for delivery
QUIT
221 2.0.0 mis1.honsec.com.tw closing connection

檢查信箱是否收到郵件

手機學習筆記

設定手機同時啟用3G和無線功能,但使用3G上網。 因為裝設的無線監視器使用的無線AP分享器無法上網,想要使用手機看監視器畫面,必需啟用手機無線功能,正常狀況下會變成使用無線AP上網,所以必需調整手機無線AP上網設定,才能繼續使用3G上網。
設定方式就是把無線wifi設成固定IP但不要設定路由器IP和DNS。

在CentOS 7 執行php command line程式寄信

在CentOS 7 執行php command line程式寄信

1.先安裝CentOS 7最小安裝

2.裝完後無法執行php

3.安裝Php

install php 5.6
#rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
#rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#yum install php56w php56w-opcache

顯示php已加載的模組
[root@localhost php]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
ereg
exif
fileinfo
filter
ftp
gettext
......


沒有看到mysql模組

安裝mysql資料庫
Install MySQL 5.6 on CentOS 7

Add the Repository
#sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

Install MySQL Packages
#sudo yum -y install mysql-community-server  (包含mysql client)

Start MySQL Server
#sudo /usr/bin/systemctl enable mysqld
#sudo /usr/bin/systemctl start mysqld

Secure MySQL 設定資料庫權限
#sudo /usr/bin/mysql_secure_installation


安裝php-mysql
install php-mysql 出現error
#yum install php-mysql
....
Error: php56w-common conflicts with php-common-5.4.16-23.el7_0.3.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

移除php56w-common
#yum remove php56w-common
重新安裝php-mysql
#yum install php-mysql
安裝成功

測試使用php script寄信

測試程式碼:

begin-------------------------------------------------

#!/usr/bin/php

  //sendmail begin

  $subject = "=?UTF-8?B?".base64_encode('每日寄信檢查作業')."?="; //信件標題
  $msg = "每天09:30系統會寄出此封信件

";
  $msg = $msg . "請記錄收到信的時間,若超過30分鐘,表示異常,必須通知管理員處理
";
  $headers = "From: monkey@xxxx.com.tw\r\n".
                     "MIME-Version: 1.0" . "\r\n" .
                 "Content-type: text/html; charset=UTF-8" . "\r\n";; //寄件者
  if(mail("kitty@gmail.com", "$subject", "$msg", "$headers"))
    print "通知已經發送成功。
";//寄信成功就會顯示的提示訊息
  else
    print "通知發送失敗!
";//寄信失敗顯示的錯誤訊息

?>

end-----------------------------------------------------

存檔到/php/ex009.php
#chmod +x /php/ex009.php
執行寄信程式
[root@localhost php]# ./ex009.php
通知已經發送成功。


檢查email信箱,有收到信件

程式碼說明
#!/usr/bin/php
程式第一行有此程式碼,就可以值接執行此指令
$subject = "=?UTF-8?B?".base64_encode('每日寄信檢查作業')."?="; //信件標題
這不是亂碼,是要將郵件標題用base64加密,以符合信件主旨格式,收到的人才不會看到亂碼。










2015年4月29日 星期三

寫一支程式,可以從個人電腦使用notes client寄信

寫一支程式,可以從個人電腦使用notes client寄信

1.用notepad++寫程式

VBScript如下:
begin----------------------------------------------------------------------------------------------------

'VBScript 由Client PC使用notes client寄信
'執行時Notes Client必須開啟

Const EMBED_ATTACHMENT = 1454
Set nSession = CreateObject("Notes.NotesSession")
'Gets the current user’s mail database
Set db = nSession.GetDataBase("","")
If Not db.IsOpen = True Then
db.OpenMail
End If
Set doc = db.CreateDocument
doc.Form = "Memo"
doc.Sendto = "kitty@msn.com"
doc.Subject = "寄信測試"
doc.Body = "每天10:00系統會自動寄信,請於10:30檢查是否收到信並記錄收到信的時間,若超過30分鐘沒有收到信,表示異常,必須通知郵件管理員檢查。"

'Set up the embedded object and attachment and attach it

sAttachment = "d:\temp\aaaa.txt"

Set AttachME = doc.CreateRichTextItem("Attachment")

Set EmbedObj = AttachME.EmbedObject _
(EMBED_ATTACHMENT, "", sAttachment, "Attachment")

doc.Send(False)


end------------------------------------------------------------------------------------------------------

2.存檔到d:\temp\sendmail.vbs

3.開啟工作排程器,設定每天10:00執行此script寄信

4.注意事項
執行時Notes Client要先開啟。

2012年1月9日 星期一

學習程式設計的網站

學習程式設計的網站 Codecademy is the easiest way to learn how to code. It's interactive, fun, and you can do it with your friends. 網址:http://www.codecademy.com 開啟此網站必須使用Chrome、Firefox或Opera,若使用IE,網站會要求您安裝 Google Chrome Frame

2010年1月21日 星期四

FreeBasic學習筆記

1.下載freebasic
http://www.freebasic.net/

參考資料
http://kyovbdx.myweb.hinet.net/

2009年9月29日 星期二

OpenSky is a free service provided by Gizmo5

OpenSky is a free service provided by Gizmo5 which allows any mobile phone, web browser or IP aware phone network (SIP, asterisk, etc) to communicate with Skype users. OpenSky supports sending text messages and voice calls.

ubuntu 安裝完kubernetes後做apt-get update會出現錯誤

root@k8s02:~# sudo apt-get update 已有:1 http://tw.archive.ubuntu.com/ubuntu xenial InRelease 已有:2 http://tw.archive.ubuntu.com/ubuntu xenia...