Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么';这个python脚本是否适用于AT&;T用户?_Python_Linux_Sms - Fatal编程技术网

为什么';这个python脚本是否适用于AT&;T用户?

为什么';这个python脚本是否适用于AT&;T用户?,python,linux,sms,Python,Linux,Sms,我已经写了一个基本的短信发送python脚本作为练习的一种形式。它似乎适用于除AT&T以外的所有主要运营商。值得注意的是,它不会返回错误。有什么建议吗 import smtplib import sys print """ Instructions: Type the cellphone number in without symbols. Then select one of the following messages to send by entering the number pre

我已经写了一个基本的短信发送python脚本作为练习的一种形式。它似乎适用于除AT&T以外的所有主要运营商。值得注意的是,它不会返回错误。有什么建议吗

import smtplib
import sys

print """
Instructions:

Type the cellphone number in without symbols.
Then select one of the following messages to send
by entering the number preceding the message:

1. Your prescription is ready. Call *xxx-xxx-xxxx*
   with any questions.
2. Your prescription was attempted to be filled
   to early. Call *xxx-xxx-xxxx* with any questions.
3. Your prescription needs your Doctor's approval.
   Call *xxx-xxx-xxxx* with any questions.
"""
#gets the number and mess from user                     
number = raw_input('Cellphone Number: ')
message = raw_input('Select Message: ')

#tests to see if a 10 digit number was given 
num_test = True
while num_test == True:
    int(number)
    if len(number) == 10:
        num_test = False 
    else:
        print "The cellphone number you typed in isn't formatted correctly. Try again."
        number = raw_input('Cellphone Number: ')

#cat's number with the major mobile carrier emails 
prov_number_att = number + '@txt.att.net'
prov_number_tmo = number + '@tmomail.net'
prov_number_cin = number + '@cingularme.com'
prov_number_ver = number + '@vmobil.com'
prov_number_sprint = number + '@messaging.sprintpcs.com'
prov_number_next = number + '@messaging.nextel.com'
prov_number_alltel = number + '@message.alltel.com'
prov_number_sun = number + '@tms.suncom.com'
prov_number_vs = number + '@voicestream.net'

#combines these variables into a list so it can be iterated upon
prov_list = [prov_number_att, prov_number_tmo, prov_number_cin, prov_number_ver,
prov_number_sprint, prov_number_next, prov_number_alltel, prov_number_sun, prov_number_vs]

#securely connects to gmail's SMTP (Simple Mail Transfer Protocol) outgoing server 
server = smtplib.SMTP("smtp.gmail.com", 587)
#connection must be done with a cryptographic protocol, in this case TLS at port 587 
server.starttls()
#once connection is established, program logs in with prev. made gmail username and password
server.login("username", "password")

#tests whether the user selected one of messages correctly
mess_test = True
while mess_test == True:
    if message == '1' or message == '2' or message == '3':
        mess_test = False 
    else:
        print "That's not an optional message. Try again."
        message = raw_input('Message: ')

#selects the message the user picked        
if message == '1':
    message = 'Your prescription is ready. Call xxx-xxx-xxxx with any questions.'
else:
    pass
if message == '2':
    message = 'Your prescription was attempted to be filled to early. Call xxx-xxx-xxxx with any questions.'
else:
    pass
if message == '3':
    message ="Your prescription needs more refills. We've called for Doctor's approval. Call xxx-xxx-xxxx with any questions."
else:
    pass

#sends the selected message to each element of prov_list    
for p in prov_list:
server.sendmail('name', p, message)

当你在不使用脚本的情况下向该电子邮件地址发送消息时,它是否有效?此外,由于我编写脚本的方式效率低下(在所有主要运营商的列表中运行脚本),我收到报告任何错误的电子邮件,但我没有收到那个错误电子邮件。也许他们阻止了你,因为你正在向非att手机发送消息,他们认定你是垃圾邮件机器人。这是一个合理的推测,谢谢。