Python smtplib.SMTP_SSL Examples

The following are 30 code examples of smtplib.SMTP_SSL(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module smtplib , or try the search function .
Example #1
Source File: informer.py    From zvt with MIT License 15 votes vote down vote up
def send_message(self, to_user, title, body, **kwargs):
        if self.ssl:
            smtp_client = smtplib.SMTP_SSL()
        else:
            smtp_client = smtplib.SMTP()
        smtp_client.connect(zvt_env['smtp_host'], zvt_env['smtp_port'])
        smtp_client.login(zvt_env['email_username'], zvt_env['email_password'])
        msg = MIMEMultipart('alternative')
        msg['Subject'] = Header(title).encode()
        msg['From'] = "{} <{}>".format(Header('zvt').encode(), zvt_env['email_username'])
        if type(to_user) is list:
            msg['To'] = ", ".join(to_user)
        else:
            msg['To'] = to_user
        msg['Message-id'] = email.utils.make_msgid()
        msg['Date'] = email.utils.formatdate()

        plain_text = MIMEText(body, _subtype='plain', _charset='UTF-8')
        msg.attach(plain_text)

        try:
            smtp_client.sendmail(zvt_env['email_username'], to_user, msg.as_string())
        except Exception as e:
            self.logger.exception('send email failed', e) 
Example #2
Source File: smtp.py    From satori with Apache License 2.0 8 votes vote down vote up
def send_mail(send_from, send_to, subject, text, files=[], server="localhost", ssl=False, username=None, password=None):
    msg = MIMEMultipart('alternative')
    msg.set_charset('utf-8')
    msg['From'] = send_from
    msg['To'] = send_to
    msg['Date'] = formatdate(localtime=True)
    msg['Subject'] = subject
    part = MIMEText(text)
    part.set_charset('utf-8')
    msg.attach(part)
    if ssl:
        smtp = smtplib.SMTP_SSL(server)
    else:
        smtp = smtplib.SMTP(server)
    if username:
        smtp.login(username, password)
    smtp.sendmail(send_from, send_to, msg.as_string())
    smtp.close() 
Example #3
Source File: envia_relatorio_por_email.py    From ir with Mozilla Public License 2.0 7 votes vote down vote up
def envia_relatorio_html_por_email(assunto, relatorio_html):
    gmail_user = os.environ['GMAIL_FROM']
    gmail_password = os.environ['GMAIL_PASSWORD']
    to = os.environ['SEND_TO'].split(sep=';')

    msg = MIMEText(relatorio_html, 'html')
    msg['Subject'] = assunto
    msg['From'] = gmail_user

    try:
        server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
        server.ehlo()
        server.login(gmail_user, gmail_password)
        for to_addrs in to:
            msg['To'] = to_addrs
            server.send_message(msg, from_addr=gmail_user, to_addrs=to_addrs)
        print('Email enviado com sucesso')
        return True
    except Exception as ex:
        print('Erro ao enviar email')
        print(ex)
        return False 
Example #4
Source File: gencon-hotel-check.py    From gencon-hotel-check with GNU General Public License v3.0 6 votes vote down vote up
def closure(host, fromEmail, toEmail):
			def smtpConnect():
				try:
					smtp = smtplib.SMTP_SSL(host)
				except socket.error:
					smtp = smtplib.SMTP(host)
				if password:
					smtp.login(fromEmail, password)
				return smtp
			try:
				smtpConnect()
				def handle(preamble, hotels):
					msg = MIMEText("%s\n\n%s\n\n%s" % (preamble, '\n'.join("  * %s: %s: %s" % (hotel['distance'], hotel['name'].encode('utf-8'), hotel['room'].encode('utf-8')) for hotel in hotels), baseUrl + '/home'), 'plain', 'utf-8')
					msg['Subject'] = 'Gencon Hotel Search'
					msg['From'] = fromEmail
					msg['To'] = toEmail
					smtpConnect().sendmail(fromEmail, toEmail.split(','), msg.as_string())
				alertFns.append(handle)
				return True
			except Exception as e:
				print(e)
				return False 
Example #5
Source File: app.py    From Python-Programming-Blueprints with MIT License 6 votes vote down vote up
def _send_message(message):

    smtp = smtplib.SMTP_SSL('email-smtp.eu-west-1.amazonaws.com', 465)

    try:
        smtp.login(
            user='AKIAITZ6BSMD7DMZYTYQ',
            password='Ajf0ucUGJiN44N6IeciTY4ApN1os6JCeQqyglRSI2x4V')
    except SMTPAuthenticationError:
        return Response('Authentication failed',
                        status=HTTPStatus.UNAUTHORIZED)

    try:
        smtp.sendmail(message['From'], message['To'], message.as_string())
    except SMTPRecipientsRefused as e:
        return Response(f'Recipient refused {e}',
                        status=HTTPStatus.INTERNAL_SERVER_ERROR)
    finally:
        smtp.quit()

    return Response('Email sent', status=HTTPStatus.OK) 
Example #6
Source File: send_email.py    From TorCMS with MIT License 6 votes vote down vote up
def send_mail(to_list, sub, content, cc=None):
    '''
    Sending email via Python.
    '''
    sender = SMTP_CFG['name'] + "<" + SMTP_CFG['user'] + ">"
    msg = MIMEText(content, _subtype='html', _charset='utf-8')
    msg['Subject'] = sub
    msg['From'] = sender
    msg['To'] = ";".join(to_list)
    if cc:
        msg['cc'] = ';'.join(cc)
    try:
        # Using SMTP_SSL. The alinyun ECS has masked the 25 port since 9,2016.
        smtper = smtplib.SMTP_SSL(SMTP_CFG['host'], port=994)
        smtper.login(SMTP_CFG['user'], SMTP_CFG['pass'])
        smtper.sendmail(sender, to_list, msg.as_string())
        smtper.close()
        return True
    except:
        return False 
Example #7
Source File: envia_relatorio_por_email.py    From ir with Mozilla Public License 2.0 6 votes vote down vote up
def envia_relatorio_txt_por_email(assunto, relatorio):
    gmail_user = os.environ['GMAIL_FROM']
    gmail_password = os.environ['GMAIL_PASSWORD']
    to = os.environ['SEND_TO'].split(sep=';')

    print('enviando email para : ' + str(to))

    try:
        server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
        server.ehlo()
        server.login(gmail_user, gmail_password)

        message = 'Subject: {}\n\n{}'.format(assunto, relatorio)
        server.sendmail(gmail_user, to, message.encode("utf8"))
        server.quit()
        print('Email enviado com sucesso')
        return True
    except Exception as ex:
        print('Erro ao enviar email')
        print(ex)
        return False 
Example #8
Source File: notifier.py    From ee-outliers with GNU General Public License v3.0 6 votes vote down vote up
def send_email(self, email_dict):
        """
        Send a notification e-mail with the content of the dictionary provided as argument
        :param email_dict: contains all information for the e-mail including body, subject, from, recipient
        """
        try:
            msg = MIMEText(email_dict["body"])
            msg['Subject'] = email_dict["subject"]
            msg['From'] = self.smtp_user
            msg['To'] = self.notification_email

            smtp_ssl_con = smtplib.SMTP_SSL(self.smtp_server, self.smtp_port)
            smtp_ssl_con.login(self.smtp_user, self.smtp_pass)
            smtp_ssl_con.send_message(msg)
            smtp_ssl_con.quit()
        except Exception:
            self.logging.logger.error("something went wrong sending notification e-mail", exc_info=True) 
Example #9
Source File: SMTPListener.py    From flare-fakenet-ng with Apache License 2.0 6 votes vote down vote up
def test(config):

    import smtplib

    logger = logging.getLogger('SMTPListenerTest')

    server = smtplib.SMTP_SSL('localhost', config.get('port', 25))

    message = "From: test@test.com\r\nTo: test@test.com\r\n\r\nTest message\r\n"

    logger.info('Testing email request.')
    logger.info('-'*80)
    server.set_debuglevel(1)
    server.sendmail('test@test.com','test@test.com', message)
    server.quit()
    logger.info('-'*80) 
Example #10
Source File: email_notifier.py    From kimsufi-crawler with MIT License 6 votes vote down vote up
def notify(self, title, text, url=None):
        """Send email notification using SMTP"""
        msg = MIMEMultipart()
        msg['From'] = self.fromaddr
        msg['To'] = self.toaddr
        msg['Subject'] = title
        body = text if url else text + '\nURL: ' + url
        msg.attach(MIMEText(body, 'plain'))
        if self.use_ssl:
            server = smtplib.SMTP_SSL(self.host, self.port)
        else:
            server = smtplib.SMTP(self.host, self.port)
        server.ehlo()
        if self.use_starttls:
            server.starttls()
            server.ehlo()
        if self.login_required:
          server.login(self.fromuser, self.frompwd)
        text = msg.as_string()
        server.sendmail(self.fromaddr, self.toaddr, text) 
Example #11
Source File: email_notifier.py    From kimsufi-crawler with MIT License 6 votes vote down vote up
def check_requirements(self):
        """Logs in to SMTP server to check credentials and settings"""
        if self.use_ssl:
            server = smtplib.SMTP_SSL(self.host, self.port)
        else:
            server = smtplib.SMTP(self.host, self.port)
        server.ehlo()
        if self.use_starttls:
            server.starttls()
            server.ehlo()
        try:
            if self.login_required:
                server.login(self.fromuser, self.frompwd)
        except Exception as ex:
            _logger.error("Cannot connect to your SMTP account. "
                          "Correct your config and try again. Error details:")
            _logger.error(ex)
            raise
        _logger.info("SMTP server check passed") 
Example #12
Source File: core.py    From weekly-email-subscribe with MIT License 6 votes vote down vote up
def send_email():
    """
    发送邮件
    """
    if not is_friday():
        return

    content = get_email_content()
    message = MIMEText(content, "html", MAIL_ENCODING)
    message["From"] = Header("weekly-bot", MAIL_ENCODING)
    message["To"] = Header("Reader")
    message["Subject"] = Header("weekly", MAIL_ENCODING)
    try:
        smtp_obj = smtplib.SMTP_SSL(MAIL_HOST)
        smtp_obj.login(MAIL_USER, MAIL_PASS)
        smtp_obj.sendmail(MAIL_SENDER, MAIL_RECEIVER, message.as_string())
        smtp_obj.quit()
    except Exception as e:
        print(e) 
Example #13
Source File: gmailhack.py    From gmailhack with GNU General Public License v3.0 6 votes vote down vote up
def login():
    i = 0
    usr = raw_input('What is the targets email address :')
    server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
    server.ehlo()
    for passw in pass_lst:
      i = i + 1
      print str(i) + '/' + str(len(pass_lst))
      try:
         server.login(usr, passw)
         print '[+] Password Found: %s ' % passw
         break
      except smtplib.SMTPAuthenticationError as e:
         error = str(e)
         if error[14] == '<':
            print '[+] Password Found: %s ' % passw
            break
         else:
            print '[!] Password Incorrect: %s ' % passw 
Example #14
Source File: smtp.py    From satori with Apache License 2.0 6 votes vote down vote up
def send_mail(send_from, send_to, subject, text, files=[], server="localhost", ssl=False, username=None, password=None):
    msg = MIMEMultipart('alternative')
    msg.set_charset('utf-8')
    msg['From'] = send_from
    msg['To'] = send_to
    msg['Date'] = formatdate(localtime=True)
    msg['Subject'] = subject
    part = MIMEText(text)
    part.set_charset('utf-8')
    msg.attach(part)
    if ssl:
        smtp = smtplib.SMTP_SSL(server)
    else:
        smtp = smtplib.SMTP(server)
    if username:
        smtp.login(username, password)
    smtp.sendmail(send_from, send_to, msg.as_string())
    smtp.close() 
Example #15
Source File: test_smtpnet.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_connect_starttls(self):
        support.get_attribute(smtplib, 'SMTP_SSL')
        context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
        with support.transient_internet(self.testServer):
            server = smtplib.SMTP(self.testServer, self.remotePort)
            try:
                server.starttls(context=context)
            except smtplib.SMTPException as e:
                if e.args[0] == 'STARTTLS extension not supported by server.':
                    unittest.skip(e.args[0])
                else:
                    raise
            server.ehlo()
            server.quit() 
Example #16
Source File: mail.py    From TencentComicBook with MIT License 5 votes vote down vote up
def send(cls, subject, content=None, file_list=None, debug=None,
             sender=None, sender_passwd=None, receivers=None):
        """"发送邮件
        :param str subject: 邮件主题/标题
        :param str content: 正文内容
        :param list file_list: 附件的路径列表
        """
        receivers = receivers or cls.receivers
        sender = sender or cls.sender
        sender_passwd = sender_passwd or cls.sender_passwd

        msg = MIMEMultipart()
        msg['Subject'] = subject
        msg['From'] = cls.sender
        msg['To'] = ';'.join(receivers)

        if content is not None:
            msg.attach(MIMEText(content, 'plain', 'utf-8'))

        if file_list is not None:
            for file in file_list:
                msg.attach(cls.built_attach(file))

        try:
            s = SMTP_SSL(cls.smtp_server, cls.smtp_port)
            if debug:
                s.set_debuglevel(1)
            s.login(sender, sender_passwd)
            logger.info('正在向 {} 发送 {}'.format(','.join(receivers), subject))
            s.sendmail(sender, receivers, msg.as_string())
            s.quit()
        except smtplib.SMTPException as e:
            logger.info('发送 {} 邮件时出现错误!error:{}'.format(subject, e))
            raise 
Example #17
Source File: email.py    From mycroft with MIT License 5 votes vote down vote up
def mail_result(self, final_status, msg, additional_info=None):
        link = self.link_temp.format(msg['uuid'])
        content = self.template.format(
            msg['uuid'], final_status, msg['log_name'], msg['log_schema_version'],
            msg['s3_path'], msg['redshift_id'], msg['start_date'], msg['end_date'], link,
            additional_info
        )

        new_msg = MIMEText(content)
        new_msg['Subject'] = self.subject.format(msg['uuid'])
        new_msg['From'] = self.address
        new_msg['To'] = ','.join(msg['contact_emails'])

        smtp_host = staticconf.read_string('smtp_host', 'localhost')
        smtp_port = staticconf.read_string('smtp_port', None)
        smtp_login = staticconf.read_string('smtp_login', None)
        smtp_password = staticconf.read_string('smtp_password', None)
        smtp_security = staticconf.read_string('smtp_security', None)

        if smtp_port is not None:
            smtp_host = "{0}:{1}".format(smtp_host, smtp_port)

        if smtp_security is not None:
            smtp_security = smtp_security.upper()

        if smtp_security == 'SSL':
            s = smtplib.SMTP_SSL(smtp_host)
            s.login(smtp_login, smtp_password)
        elif smtp_security == 'TLS':
            s = smtplib.SMTP(smtp_host)
            s.ehlo()
            s.starttls()
            s.login(smtp_login, smtp_password)
        else:
            s = smtplib.SMTP(smtp_host)

        s.sendmail(self.address, msg['contact_emails'], new_msg.as_string())
        s.quit() 
Example #18
Source File: test_smtpnet.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_connect_starttls(self):
        support.get_attribute(smtplib, 'SMTP_SSL')
        context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
        with support.transient_internet(self.testServer):
            server = smtplib.SMTP(self.testServer, self.remotePort)
            try:
                server.starttls(context=context)
            except smtplib.SMTPException as e:
                if e.args[0] == 'STARTTLS extension not supported by server.':
                    unittest.skip(e.args[0])
                else:
                    raise
            server.ehlo()
            server.quit() 
Example #19
Source File: poriluk.py    From tactical-exploitation with MIT License 5 votes vote down vote up
def smtp_enum(args):
    """
    SMTP protocol exploitation
    """

    wordlist = [u.rstrip() for u in args.w]
    targets = get_targets(args)
    port = args.P
    ssl = args.S
    timeout = args.T
    debug = args.D
    found_glob = 0

    if args.vrfy:
        cmd = "VRFY"
    elif args.expn:
        cmd = "EXPN"
    elif args.rcpt:
        cmd = "RCPT TO:"

    if ssl:
        call = smtplib.SMTP_SSL
    else:
        call = smtplib.SMTP

    for host in targets:
        found_host = 0
        print("*** SMTP users on {0} ***\n".format(host))
        found_host += smtp_do(call, cmd, wordlist, host, port, timeout, debug)
        found_glob += found_host
        print("\n*** {0} users found on {1} ***\n".format(found_host, host))

    print("*** {0} users found globally ***\n".format(found_glob)) 
Example #20
Source File: email.py    From patchew with MIT License 5 votes vote down vote up
def _get_smtp(self):
        server = self.get_config("smtp", "server")
        port = self.get_config("smtp", "port")
        username = self.get_config("smtp", "username")
        password = self.get_config("smtp", "password")
        ssl = self.get_config("smtp", "ssl", "getboolean")
        if settings.DEBUG:
            return DebugSMTP()
        elif ssl:
            smtp = smtplib.SMTP_SSL(server, port)
        else:
            smtp = smtplib.SMTP(server, port)
        if self.get_config("smtp", "auth", "getboolean"):
            smtp.login(username, password)
        return smtp 
Example #21
Source File: email.py    From notifiers with MIT License 5 votes vote down vote up
def _connect_to_server(self, data: dict):
        self.smtp_server = smtplib.SMTP_SSL if data["ssl"] else smtplib.SMTP
        self.smtp_server = self.smtp_server(data["host"], data["port"])
        self.configuration = self._get_configuration(data)
        if data["tls"] and not data["ssl"]:
            self.smtp_server.ehlo()
            self.smtp_server.starttls()

        if data["login"] and data.get("username"):
            self.smtp_server.login(data["username"], data["password"]) 
Example #22
Source File: ali4ddns.py    From scripts with Apache License 2.0 5 votes vote down vote up
def send(self, subject, body, to_mails, files, mail_type='plain'):
        """
            subject: 邮件主题
            body: 邮件内容
            to_mail: 收件人,英文逗号,分隔
            files: 附件路径,list列表
        """
        to_mails = str(to_mails).split(',')
        to_mails = [item.strip() for item in to_mails]

        # 创建一个带附件的实例
        message = MIMEMultipart()
        message['From'] = Header(self.from_mail, 'utf-8')
        message['To'] = ', '.join(to_mails)
        message['Subject'] = Header(subject, 'utf-8')

        # 邮件正文内容
        message.attach(MIMEText(body, mail_type, 'utf-8'))

        # 构造附件,传送当前目录下的 test.txt 文件
        for myfile in files:
            att1 = MIMEText(open(myfile, 'rb').read(), 'base64', 'utf-8')
            att1["Content-Type"] = 'application/octet-stream'

            basename = u'%s' % os.path.basename(myfile)
            att1["Content-Disposition"] = "attachment; filename=%s" % basename.encode('utf-8')
            message.attach(att1)

        try:
            if self.is_ssl:
                s = smtplib.SMTP_SSL(self.smtp_server, self.smtp_port, timeout=30)
            else:
                s = smtplib.SMTP(self.smtp_server, self.smtp_port, timeout=30)
            if self.is_tls and not self.is_ssl:
                s.starttls()
            #s.set_debuglevel(1)
            s.login(self.from_mail, self.mail_pass)
            s.sendmail(self.from_mail, to_mails, message.as_string())
            s.quit()
        except smtplib.SMTPException as e:
            self.__writeError(e) 
Example #23
Source File: mailer.py    From SecPi with GNU General Public License v3.0 5 votes vote down vote up
def send_mail_ssl(self):
		logging.debug("Mailer: Trying to send mail with SSL")
		try:
			logging.debug("Mailer: Establishing connection to SMTP server...")
			smtp = smtplib.SMTP_SSL(self.smtp_address, self.smtp_port)
			smtp.ehlo()
			logging.debug("Mailer: Logging in...")
			smtp.login(self.smtp_user, self.smtp_pass)
			smtp.sendmail(self.message["From"], self.message["To"].split(','), self.message.as_string())
			logging.info("Mailer: Mail sent")
			smtp.quit()
		except Exception as e:
			logging.error("Mailer: Unknown error: %s" % e) 
Example #24
Source File: test.py    From flare-fakenet-ng with Apache License 2.0 5 votes vote down vote up
def _test_smtp_ssl(self, sender, recipient, msg, hostname, port=None, timeout=5):
        smtpserver = smtplib.SMTP_SSL(hostname, port, 'fake.net', None, None, timeout)
        server.sendmail(sender, recipient, msg)
        smtpserver.quit() 
Example #25
Source File: drymail.py    From drymail with MIT License 5 votes vote down vote up
def connect(self):
        """
        Create the SMTP connection.
        """
        self.client = SMTP(self.host, self.port) if not self.ssl else SMTP_SSL(self.host, self.port,
                                                                               **self.__ssloptions)
        self.client.ehlo()
        if self.tls:
            self.client.starttls()
            self.client.ehlo()
        if self.user and self.password:
            self.client.login(self.user, self.password)
        self.connected = True 
Example #26
Source File: patator.py    From patator with GNU General Public License v2.0 5 votes vote down vote up
def connect(self, host, port, ssl, helo, starttls, timeout):

    if ssl == '0':
      if not port:
        port = 25
      fp = SMTP(timeout=int(timeout))
    else:
      if not port:
        port = 465
      fp = SMTP_SSL(timeout=int(timeout))

    resp = fp.connect(host, int(port))

    if helo:
      cmd, name = helo.split(' ', 1)

      if cmd.lower() == 'ehlo':
        resp = fp.ehlo(name)
      else:
        resp = fp.helo(name)

    if not starttls == '0':
      resp = fp.starttls()

    return TCP_Connection(fp, resp) 
Example #27
Source File: email_client.py    From Kijiji-Scraper with MIT License 5 votes vote down vote up
def mail_ads(self, ad_dict, email_title):
        subject = self.__create_email_subject(email_title, len(ad_dict))
        body = self.__create_email_body(ad_dict)

        msg = MIMEText(body, 'html')
        msg['Subject'] = subject
        msg['From'] = self.from_email
        msg['To'] = self.receiver

        server = smtplib.SMTP_SSL(self.smtp_server, self.smtp_port)

        server.ehlo()
        server.login(self.username, self.password)
        server.send_message(msg)

        server.quit() 
Example #28
Source File: util.py    From HDU with GNU General Public License v3.0 5 votes vote down vote up
def send_email(from_addr, psw, to_addr, content):
    msg = MIMEText(''.join(content), 'plain', 'utf-8')
    msg['From'] = 'HDU-Notify<{sender}>'.format(sender=from_addr)
    msg['To'] = '<{to_addr}>'.format(to_addr=to_addr)
    msg['Subject'] = '课程通知-已监控到你要的课程'

    server = smtplib.SMTP_SSL('smtp.qq.com', 465)
    # server.set_debuglevel(1)
    server.login(from_addr, psw)
    server.sendmail(from_addr, [to_addr], msg.as_string())
    server.quit() 
Example #29
Source File: email.py    From airflow with Apache License 2.0 5 votes vote down vote up
def send_mime_email(e_from, e_to, mime_msg, dryrun=False):
    """
    Send MIME email.
    """

    smtp_host = conf.get('smtp', 'SMTP_HOST')
    smtp_port = conf.getint('smtp', 'SMTP_PORT')
    smtp_starttls = conf.getboolean('smtp', 'SMTP_STARTTLS')
    smtp_ssl = conf.getboolean('smtp', 'SMTP_SSL')
    smtp_user = None
    smtp_password = None

    try:
        smtp_user = conf.get('smtp', 'SMTP_USER')
        smtp_password = conf.get('smtp', 'SMTP_PASSWORD')
    except AirflowConfigException:
        log.debug("No user/password found for SMTP, so logging in with no authentication.")

    if not dryrun:
        conn = smtplib.SMTP_SSL(smtp_host, smtp_port) if smtp_ssl else smtplib.SMTP(smtp_host, smtp_port)
        if smtp_starttls:
            conn.starttls()
        if smtp_user and smtp_password:
            conn.login(smtp_user, smtp_password)
        log.info("Sent an alert email to %s", e_to)
        conn.sendmail(e_from, e_to, mime_msg.as_string())
        conn.quit() 
Example #30
Source File: test_smtpnet.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_connect(self):
        support.get_attribute(smtplib, 'SMTP_SSL')
        with support.transient_internet(self.testServer):
            server = smtplib.SMTP_SSL(self.testServer, self.remotePort)
            server.ehlo()
            server.quit()