Sending an email with Python from a Protonmail account, SMTP library

This might help..

import smtplib 
from email.MIMEMultipart import MIMEMultipart 
from email.MIMEText import MIMEText

port_number =1234
msg = MIMEMultipart()
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'
msg['Subject'] = 'My Test Mail '
message = 'This is the body of the mail'
msg.attach(MIMEText(message))
mailserver = smtplib.SMTP('localhost',port_number)
mailserver.login("[email protected]", "mypassword")
mailserver.sendmail('[email protected]','[email protected]',msg.as_string())
mailserver.quit()

I'm pretty new to this and was having some significant trouble.... until I just made the following tiny change:

Change the from lines to this:

import smtplib 
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

port_number =1234
msg = MIMEMultipart()
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'
msg['Subject'] = 'My Test Mail '
message = 'This is the body of the mail'
msg.attach(MIMEText(message))
mailserver = smtplib.SMTP('localhost',port_number)
mailserver.login("[email protected]", "mypassword")
mailserver.sendmail('[email protected]','[email protected]',msg.as_string())
mailserver.quit()