title: smtplib.SMTPRecipientsRefused error on Python script
body: <p>I have got this code:</p>
  
  <pre><code>import smtplib
  import os 
  import time
  import sys
  import argparse
  from email.MIMEMultipart import MIMEMultipart
  from email.MIMEText import MIMEText
  
  
      class smsGatewaying:
  
  
          def login_gmail(self,user,password):
              self.server = smtplib.SMTP("smtp.gmail.com", 587)
              self.server.starttls()
  
              try:
                  gmail_user = args.gmail_user
                  gmail_password = args.gmail_password
              except SMTPAuthenticationError:
                  print "SMTP authentication went wrong. Most probably the server didn't accept the username/password combination provided."
              finally:
                  if gmail_password &lt; '1':
                      print 'Insert a password!'
                      gmail_password = getpass.getpass(prompt="Insert the GMail password: ")
                  else:
                      self.server.login(gmail_user, gmail_password)
                      print 'Login successfully.'
                      time.sleep(0.75)
                      x.select_country()
  
  
          def select_country(self):
              print 'Insert country: '
              country = raw_input()
  
              if country == 'Italy' or country == 'italy':
  
                  italian_carriers = ['number@sms.vodafone.it',
                                      '39number@timnet.com']
  
                  select_carriers = raw_input("Select carriers: ")
  
                  if select_carriers == 'Vodafone' or select_carriers == 'vodafone':
                      number = 0
                  elif select_carriers == 'TIM' or select_carriers == 'tim' or select_carriers == 'Tim':
                      number = 1
                  else:
                      print "L'operatore telefonico selezionato non è disponibile."
                      time.sleep(0.80)
                      x.select_country()
  
  
  
                  x.send_message_normal(italian_carriers[number])
  
              else:
                  sys.exit()
  
  
  
          def send_message_normal(self, carriers):
              msg = MIMEMultipart()
              msg['sender'] = raw_input("Insert sender: ")
              msg['telephone'] = input("Insert telephone number: ")
              text = raw_input("Insert text: ")
              msg.attach = (MIMEText(text))
  
              carriers.replace('number',str(msg['telephone']))
  
              final = raw_input("Are you sure?[Y/N] ")
  
  
              if final == 'y' or final == 'Y':
  
                  self.server.sendmail(msg['sender'],str(msg['telephone']),text) 
  
              elif final == 'n' or final == 'N':
                  exit_ = raw_input("Do you want to exit?[Y/N] ")
  
                  if exit_ == 'Y' or exit_ == 'y':
  
                      print 'Run main script...'
                      newWorkingDirectory = '../BRES.py'
                      os.path.join(os.path.abspath(sys.path[0]), newWorkingDirectory)
                      os.system('python BRES.py')
  
  
      if __name__ == '__main__':
          parser = argparse.ArgumentParser()
          parser.add_argument("gmail_user", type=str)
          parser.add_argument("gmail_password",type=str)
  
          args = parser.parse_args()
  
  
          x = smsGatewaying()
          print 'Welcome to SMS Gatewaying service! Multiple countries and multiple carriers are available.'
          time.sleep(1)
          x.login_gmail(args.gmail_user,args.gmail_password)
  </code></pre>
  
  <p>After the trying to send message to a number, I got this error on shell:</p>
  
  <blockquote>
    <p>smtplib.SMTPRecipientsRefused: {'29403983292209': (553, "5.1.2 We
    weren't able to find the recipient domain. Please check for any\n5.1.2
    spelling errors, and make sure you didn't enter any spaces,
    periods,\n5.1.2 or other punctuation after the recipient's email
    address. a6sm58887940eei.10 - gsmtp")}</p>
  </blockquote>
  
  <p>I tried all, but without solutions :(</p>