mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
Add authentication.
This commit is contained in:
parent
eca4d4e701
commit
4a1c9b0cce
13
requestsync
13
requestsync
@ -183,6 +183,19 @@ if mailserver:
|
||||
else :
|
||||
mailserver = 'fiordland.ubuntu.com'
|
||||
|
||||
# connect to the server
|
||||
s = smtplib.SMTP(mailserver)
|
||||
|
||||
# authenticate to the server
|
||||
mailserver_user = os.getenv('DEBSMTP_USER')
|
||||
mailserver_pass = os.getenv('DEBSMTP_PASS')
|
||||
if mailserver_user and mailserver_pass:
|
||||
try:
|
||||
s.login(mailserver_user, mailserver_pass)
|
||||
except smtplib.SMTPAuthenticationError:
|
||||
print 'Error authenticating to the server: invalid username and password.'
|
||||
s.quit(); sys.exit(1)
|
||||
|
||||
|
||||
s.sendmail(myemailaddr, to, mail)
|
||||
s.quit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user