-2
我正在使用SMS網關發送使用python腳本的SMS消息。在短信中,我會將URL中的用戶電子郵件作爲get參數發送。但是,無論何時我使用電子郵件地址發送短信,它都會顯示@爲「倒置?」。符號。請參閱下面的代碼:短信使用python的字符@顯示爲倒置?
message = u'Click url http://services.indg.in/[email protected] to activate account'
values = {'username' : username,
'password' : password,
'smsservicetype' : smsservicetype,
'content' : message,
'mobileno' : numbers,
'senderid' : senderid
}
url = 'gateway url comes here'
postdata = urllib.urlencode(values)
req = urllib2.Request(url, postdata)
req.add_header("Content-Type","application/x-www-form-urlencoded");
req.add_header("User-Agent","Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)");
try:
response = urllib2.urlopen(req)
print response
response_url = response.geturl()
if response_url==url:
print 'SMS sent!'
except urllib2.URLError, e:
print 'Send failed!'
print e.reason
你用捲曲試過了嗎?只是爲了測試.. – brunsgaard 2014-09-22 11:18:42