summaryrefslogtreecommitdiffstats
path: root/cvp/opnfv_testapi/common/utils.py
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2018-07-05 22:37:35 -0400
committerGeorg Kunz <georg.kunz@ericsson.com>2018-07-25 09:17:09 +0000
commit58b91dd3baaaf72ab65062a4804403cd4a5935b2 (patch)
tree801b1f39b3bee25ecbaae387339955d55651e98b /cvp/opnfv_testapi/common/utils.py
parent947f1bf0147c40971fdae36feecd477ab3caf3b8 (diff)
Move OVP web portal code to a separate repo
The new repo for web portal is https://gerrit.opnfv.org/gerrit/dovetail-webportal JIRA: DOVETAIL-671 Change-Id: Iac085abc3d175b9a091d70d0448af56c7a6845e9 Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'cvp/opnfv_testapi/common/utils.py')
-rw-r--r--cvp/opnfv_testapi/common/utils.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/cvp/opnfv_testapi/common/utils.py b/cvp/opnfv_testapi/common/utils.py
deleted file mode 100644
index 107c7099..00000000
--- a/cvp/opnfv_testapi/common/utils.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import logging
-import smtplib
-from email.mime.text import MIMEText
-
-LOG = logging.getLogger(__name__)
-LOG.setLevel(logging.DEBUG)
-
-
-def send_email(subject, content):
- MAIL_LIST = ['cvp@opnfv.org']
- HOST = "smtp.gmail.com"
- USER = "opnfv.cvp"
- PASSWD = "opnfv@cvp"
-
- sender = 'cvp<{}@gmail.com>'.format(USER)
- msg = MIMEText(content, _subtype='plain')
- msg['Subject'] = subject
- msg['From'] = sender
- msg['To'] = ";".join(MAIL_LIST)
-
- _send_email(HOST, sender, USER, PASSWD, MAIL_LIST, msg)
-
-
-def _send_email(host,
- sender,
- user,
- passwd,
- receivers,
- msg):
-
- client = smtplib.SMTP()
- try:
- client.connect(host, 25)
- LOG.debug('Success to connect server')
- client.starttls()
- client.login(user, passwd)
- LOG.debug('Success to login')
- LOG.debug('Start to sending email')
- client.sendmail(sender, receivers, msg.as_string())
- client.close()
- except Exception:
- LOG.exception('Error when sending email')
- raise