本文整理汇总了Python中smtplib.SMTP.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python SMTP.__init__方法的具体用法?Python SMTP.__init__怎么用?Python SMTP.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smtplib.SMTP
的用法示例。
在下文中一共展示了SMTP.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self, host='', port=0, local_hostname=None, config=VDOM_config()):
self.tout = config.get_opt("SMTP-SENDMAIL-TIMEOUT")
if None == self.tout: self.tout = 30.0
self.tout = float(self.tout)
self.use_ssl = config.get_opt("SMTP-OVER-SSL")
if None == self.use_ssl: self.use_ssl = 0
SMTP.__init__(self, host = '', port = 0, local_hostname = None)
示例2: spam
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def spam(self):
SMTP.__init__(self, self.host, self.port)
self.ehlo()
self.starttls()
self.ehlo()
self.login(self.user, self.password)
self.sendmail(self.user, self.receiver, self.msg.as_string())
self.quit()
示例3: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self, account, password):
'''Initialize a new instance with Google account and password'''
self.account = account
SMTP.__init__(self, 'smtp.gmail.com', 587)
self.ehlo()
self.starttls()
self.ehlo()
self.login(self.account, password)
示例4: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self, parent, **kwargs):
self.parent = parent
self.make_response = parent.make_response
self._last_smtp_response = (None, None)
self.tls = kwargs.pop('tls', False)
self.debug = kwargs.pop('debug', False)
self.user = kwargs.pop('user', None)
self.password = kwargs.pop('password', None)
SMTP.__init__(self, **kwargs)
self.initialize()
示例5: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self, tunnelhost, host='', port=0, local_hostname=None):
"""Initialize a new instance.
tunnelhost:
The server to SSH through. SSH must be configured for passwordless
login to this server.
host:
The remote mailserver.
port:
The port on the mailserver, default: smtplib.SMTP_PORT.
local_hostname:
The FQDN of the local host, default: socket.getfqdn().
An SMTPConnectError is raised if the specified mail host doesn't
respond correctly.
"""
self.tunnelhost = tunnelhost
SMTP.__init__(self, host=host, port=port,
local_hostname=local_hostname)
示例6: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self,server='localhost',
from_name=Osiride().get_username(),
from_mail=Osiride().get_usermail()):
SMTP.__init__(self,server)
self.from_name = from_name
self.from_mail = from_mail
示例7: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self, server, serverUser=None, serverPassword=None, port=25):
"Connect to the given SMTP server."
SMTP.__init__(self, server, port)
self.user = serverUser
self.password = serverPassword
示例8: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self, server, serverUser=None, serverPassword=None, port=25):
SMTP.__init__(self, server, port)
self.user = serverUser
self.password = serverPassword
示例9: __init__
# 需要导入模块: from smtplib import SMTP [as 别名]
# 或者: from smtplib.SMTP import __init__ [as 别名]
def __init__(self,host='',port=0,local_hostname=None):
SMTP.__init__(self, host, port, local_hostname)
# Use a dummy function for the progress bar
self.progressBar=lambda total,sent,speed,elapsed:None
self.ui=None