Matthias: Gmail requires a SSL Authenticated connection using TLS. It is configured to look for traffic from port 587.
I looked at the alarm.py code on the master branch in github (weewx/alarm.py at master · weewx/weewx (github.com) <https://github.com/weewx/weewx/blob/master/examples/alarm.py> and it is already set appropriately for the smtplib package for SSL, but the port is not expressively set, so it is defaulting to port 465 per the smtplib package spec ( smtplib — SMTP protocol client — Python 3.9.6 documentation <https://docs.python.org/3/library/smtplib.html>) So I would do the following: 1. I would try Gary's suggestion in putting the port after the smtp_host line. 2. If that does not work, then I would modify the alarm.py code to supply the port in this manner # Starting at line 168 try: # First try end-to-end encryption s = smtplib.SMTP_SSL(self.smtp_host, timeout=self.timeout, port=587) syslog.syslog(syslog.LOG_DEBUG, "alarm: using SMTP_SSL on port 587") Please let me know if that helps. Doug On Friday, July 30, 2021 at 8:22:30 AM UTC-4 gjr80 wrote: > What about smtp_host = smtp.gmail.com:587 ? If you search the forums for > ‘smtp.gmail’ you will find a few threads where folks have had gmail smtp > issues plus a few suggestions for troubleshooting. > > Gary > > On Friday, 30 July 2021 at 22:14:19 UTC+10 [email protected] wrote: > >> Hello all together, >> >> it seems I can't get the alarm.py running. >> I always get an error during authentication to google server: >> alarm: SMTP mailer refused message with error (535, b'5.7.8 Username and >> Password not accepted. Learn more at\n5.7.8 >> https://support.google.com/mail/?p=BadCredentials j13sm1499223wms.24 - >> gsmtp') >> >> I am using the following config: >> >> [Alarm] >> expression = outTemp > 24.0 >> time_wait = 1800 >> smtp_host = smtp.gmail.com >> smtp_user = relaymtx >> smtp_password = mypassword >> from = weewx >> mailto = mymail >> subject = Alarm from weewx! >> count_treshold = 10 >> >> I did several attempts in changing the smtp_user by adding @gmail.com >> which results in the same error. >> Also tried adding port 465 to smtp.gmail.com:465 without success. >> IMAP access is activated in the gmail-account. >> So any help would be appreciated. >> >> Best regards, >> Matthias >> > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/8adfd746-55bf-462b-a04d-808325d81c68n%40googlegroups.com.
