SMS送信

□未翻訳

□翻訳中

□翻訳完了(Yota Ichino)

■レビュー(Omi Chiba)

SMS送信

web2pyアプリケーションからSMSメッセージを送信するには、受信者へリレーできるサードパーティサービスが必要です。大抵こういったサービスは無料ではありませんし、国ごとに事情が変わってきます。いくつかのサービスを利用してみましたがほとんど上手くいきませんでした。結局のところ、これらのサービスがスパムの資源として使われるため、電話会社がEメールをブロックします。

Sending SMS messages from a web2py application requires a third party service that can relay the messages to the receiver. Usually this is not a free service, but it differs from country to country. We have tried a few of these services with little success. Phone companies block emails originating from these services since they are eventually used as a source of spam.

より良い方法は電話会社自身にSMSをリレーしてもらうことです。どの電話会社も全ての携帯電話と関連づいている独自のEメールアドレスを持っていて、SMSをその電話番号へEメールとして送信できます。

A better way is to use the phone companies themselves to relay the SMS. Each phone company has an email address uniquely associated every cell-phone number the SMS can be sent as an email to that phone number.

web2pyにはこのプロセスを助けてくれるモジュールがあります:

web2py comes with a module to help in this process:

1.

2.

3.

from gluon.contrib.sms_utils import SMSCODES, sms_email

email = sms_email('1 (111) 111-1111','T-Mobile USA (tmail)')

mail.sent(to=email,subject='test',message='test')

SMSCODESは有名な電話会社名をEメールアドレスに付加したものとを照合する辞書です。sms_email関数は(文字列の)電話番号と電話会社の名前を引数に取り、その電話のEメールアドレスを返します。

SMSCODES is a dictionary that maps names of major phone companies to the email address postfix. The sms_email function takes a phone number (as a string) and the name of a phone company and returns the email address of the phone.