Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1628 from sa2ajj/smtp-check-script
add a script to check smtp with starttls connectivity
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#! /usr/bin/python -tt | ||
""" | ||
This script helps to check that the SMTP_HOST (see below) would accept STARTTLS | ||
command, and if LOCAL_HOST is acceptable for it, would check the requested user | ||
name and password would allow to send e-mail through it. | ||
""" | ||
|
||
from smtplib import SMTP | ||
|
||
from getpass import getpass | ||
|
||
SMTP_HOST = 'the host you want to send e-mail through' | ||
LOCAL_HOST = 'hostname that the SMTP_HOST would accept' | ||
|
||
def main(): | ||
""" | ||
entry point | ||
""" | ||
|
||
server = SMTP(SMTP_HOST) | ||
|
||
server.starttls() | ||
|
||
print server.ehlo(LOCAL_HOST) | ||
|
||
user = raw_input('user: ') | ||
password = getpass('password: ') | ||
|
||
print server.login(user, password) | ||
server.close() | ||
|
||
if __name__ == '__main__': | ||
main() | ||
|
||
# vim:ts=4:sw=4:et:tw=80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters