title: Sending an email multiple times with smtplib in Python
body: <p>I have written the following code to send an email that simply sends "test" to a specified email address.</p>
  
  <pre><code> import smtplib
          sentFrom = "my email" 
          to = input("Enter email:  ")
          #numberEmails = raw_input ("Enter number of emails to send")
          messageText = "test"
  
          msg = "From: %s\n To: %s\n\n%s" % (sentFrom, to, messageText)
  
          username = str("my email")  
          password = str("my password")  
  
          try :
              server = smtplib.SMTP("smtp.gmail.com", 587)
              server.ehlo()
              server.starttls()
              server.login(username,password)
              server.sendmail(sentFrom, to, msg)
              server.quit()    
              print (" Email has sent")
          except :
          print("email NOT sent")
  </code></pre>
  
  <p>When I try to send more emails than 1, for example:</p>
  
  <pre><code> 5*server.sendmail(sentFrom, to, msg)
  </code></pre>
  
  <p>Only one email sends, then I get the error "email NOT sent." I do not get an "email has sent" after the first email sends, only an "email NOT sent" print after the first. How can I fix this issue? I want to eventually have an input() so I can enter in the number of emails to send, and the program sends the number of emails entered into the input. I put how I think this would look as a comment at the top. Can I just multiply the server.sendmail command by the numberEmails command? </p>
  
  <p>This is my first day using Python so go easy on me pls. :)</p>