title: Python MIME email attachment sending method sends jpg files as "noname.eml" instead
body: <p>When I use MIME and SMTPLIB instead of sending my attachment "random.jpg" it sends "noname.eml" which is unopenable and unseeable, I am unable to send attachments correctly for this reason. Why is this caused and how can I solve it?</p>
  
  <p>I tried to change the extension from "png" to "jpg" but the issue pursues.</p>
  
  <pre><code>fromaddr1 = ""
  toaddr1 = ""
  accpass1 = ""
  
  msg1 = MIMEMultipart()
  
  msg1['From'] = fromaddr1
  msg1['To'] = toaddr1
  msg1['Subject'] = "YOUR COMPUTER HAS BEEN ACCESSED"
  
  body1 = "Someone has gained access to your computer"
  
  msg1.attach(MIMEText(body1, 'plain'))
  
  filename1 = "random.jpg" 
  attachment1 = open("random.jpg","rb")
  
  part1 = MIMEBase('application', 'octet-stream')
  part1.set_payload((attachment1).read())
  encoders.encode_base64(part1)
  part1.add_header('Content-Disposition', "attachment1; filename1= %s" % 
  filename1)
  
  msg1.attach(part1)
  
  server = smtplib.SMTP('smtp.gmail.com', 587)
  server.starttls()
  server.login(fromaddr1, accpass1)
  text = msg1.as_string()
  server.sendmail(fromaddr1, toaddr1, text)
  server.quit()
  </code></pre>