We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

what is wrong with this code (using python 3{omega 2+}) [sorry im new to this its all code but the bottom where i say i get]

  • --------------------------------------------------

    import smtplib

    class GMailServer:
    def init(self, username, password):
    self.server = smtplib.SMTP('smtp.gmail.com:587')

    def __enter__(self):
    	return self.server
    def __exit__(self, type, value, traceback):


    from email.mime.text import MIMEText

    def SendMail(server, fromaddr, toaddr, subject, body):

    msg = MIMEText(body)
    msg['Subject'] = subject
    msg['From'] = fromaddr
    msg['To'] = toaddr
    server.sendmail(fromaddr, [toaddr], msg.as_string())


    fromaddr = 'fromaddr@gmail.com'
    toaddrs = 'toaddrs@gmail.com'
    subject = 'subject'
    body = 'body text'

    username = 'fromaddr@gmail.com'
    password = 'password'

    with GMailServer(username, password) as server:
    SendMail(server, fromaddr, toaddrs, subject, body)


    i get

    root@Omega-AF87:/vision# python3 email_to_self_take_2.py
    File "email_to_self_take_2.py", line 6
    self.server = smtplib.SMTP(smtp.gmail.com:587)
    TabError: inconsistent use of tabs and spaces in indentation

  • Indentations are extremely important to the Python interpreter. It appears that Python doesn't know what parent method that line belongs to.

Log in to reply

Looks like your connection to Community was lost, please wait while we try to reconnect.