On Tue, Nov 22, 2016 at 5:15 AM, Dave Webb KB1PVH <[email protected]> wrote:

> If it's a 3rd party application sending from Gmail, you need to lower your
> Gmail account security settings to allow it.
>

Could be the problem. In particular, if you're using two-step
authentication, gmail will not work. However, the low battery utility
should have said something.

Try the following attached program. It will test your email host. Fill out
the top four lines of the program with your host information:

smtp_host = "smtp.gmail.com"       # Your email host
smtp_user = "your_username"        # The user name on the email host
smtp_password = "your_password"    # The user's password
mailto = "[email protected]"    # Email destination


Then run it using

python email_tester.py


Let us know what it says.

-tk

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# Fill out the following four lines:
smtp_host = "smtp.gmail.com"       # Your email host
smtp_user = "your_username"        # The user name on the email host
smtp_password = "your_password"    # The user's password
mailto = "[email protected]"    # Email destination

# For testing purposes, these lines should be fine:
from_   = "[email protected]"
subject = "Testing mailer"

import smtplib
from email.mime.text import MIMEText

# Form the message text:
msg_text = """This is a test of sending email via Python"""

# Convert to MIME:
msg = MIMEText(msg_text)

# Fill in MIME headers:
msg['Subject'] = subject
msg['From']    = from_
msg['To']      = mailto

# Create an instance of class SMTP for the given SMTP host:
s = smtplib.SMTP(smtp_host)
try:
    # Some servers (eg, gmail) require encrypted transport.
    # Be prepared to catch an exception if the server
    # doesn't support it.
    s.ehlo()
    s.starttls()
    s.ehlo()
    print "using encrypted transport"
except smtplib.SMTPException:
    print "using unencrypted transport"

try:
    # If a username has been given, assume that login is required for this host:
    if smtp_user:
        s.login(smtp_user, smtp_password)
        print "logged in with user name %s" % (smtp_user,)

    # Send the email:
    s.sendmail(msg['From'], mailto,  msg.as_string())
    # Log out of the server:
    s.quit()
except Exception, e:
    print "SMTP mailer refused message with error %s" % (e,)
    raise

print "email sent to: %s" % mailto

Reply via email to