這是一個簡單的Python Script, 讓您可以在CLI下使用中華電信Emome的帳號密碼傳送簡訊, 方便後端管理程式的整合
A simple Python script for CHT Taiwan user to send SMS without using Emome website
本程式使用Requests套件,您可以透過下列命令安裝.
pip install requests
This script requires Requests library. You can install it easily by:
pip install requests
請修改sample.py範例程式,首先您必須指定帳號以及密碼:
- EMOME_USERNAME = 您的中華電信emome帳號
- EMOME_PASSWORD = 您的中華電信emome密碼
然後您必須指定你想要傳送簡訊的收件人號碼,本程式支援一次發送給多位收件人,您只需要將號碼用半形逗號隔開(,)即可,一次最多可以傳給200位收件人。
- recipients = "0912345678" # 只傳給一位收件人
- recipients = "0912345678,0987654321,+886934567890" # 傳給三位收件人
接著只需準備您想要傳送的訊息內容,請注意單一則訊息長度的限制為: 英文數字為160字,中英文及數字混合為70字
- msg = u"測試訊息! test! 123!"
一切就緒了,存擋後執行sample.py即可!
The code is pretty straightforward, all you have to do is to modify sample.py. First, you need to assign your Emome username and password:
- EMOME_USERNAME = YOUR_EMOME_USERNAME
- EMOME_PASSWORD = YOUT_EMOME_PASSWORD
Then, you have to give a list of recipients. This library supports sending SMS to multiple recipients (up to 200 numbers) simultaneously.
- recipients = "0912345678" # send to single number
- recipients = "0912345678,0987654321,+886934567890" # send to three different numbers
Now, you can prepare the message that you want to SMS. Please note that the length of each message is 160 characters (Englsih alphabets) or 70 characters (Miexed English/Chinese alphabets)
You are all set! Just save and run sample.py!
本程式目前只支援傳送至台灣的行動電話號碼,如需傳送至國外,請自行修改emomeSMS.py。
This library is restricted to send SMS to Taiwan's mobile numbers. Please modify emomeSMS.py if you need to send SMS to abroad.