def connect(self):
connection_method = '<STR_LIT>' if self.ssl else '<STR_LIT>'<EOL>self._logger.debug('<STR_LIT>'.format(connection_method))<EOL>smtp = getattr(smtplib, connection_method)<EOL>if self.port:<EOL><INDENT>self._smtp = smtp(self.address, self.port)<EOL><DEDENT>else:<EOL><INDENT>self._smtp = smtp(self.address)<EOL><DEDENT>self._smtp.ehlo()<EOL>if self.tls:<EOL><INDENT>self._smtp.starttls()<EOL>self._smtp.ehlo()<EOL><DEDENT>self._logger.info('<STR_LIT>')<EOL>if self.username and self.password:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL>self._smtp.login(self.username, self.password)<EOL><DEDENT>self._connected = True<EOL>
Initializes a connection to the smtp server

        :return: True on success, False otherwise