-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyc

σ
GΨπNc@@sνdZddlmZddlmZddlZddlZddlZddlm	Z	m
Z
ddlmZm
Z
mZmZe	jdddd	d
ƒZe	jdddd	dƒZe	jd
ddd	dƒZdefd„ƒYZdS(s#A convenience class around smtplib.i(tabsolute_import(tUtilsN(tconfigtosutils(tNoDestinationAddresst	SMTPErrortDefaultSMTPConnectionRefusedtSMTPConnectionRefusedt
smtp_passwordtdefaultthelps3Password to use for authentication to SMTP server.
tsmtp_servers6Hostname of the SMTP server to use for sending email.
t
smtp_usernames3Username to use for authentication to SMTP server.
tSMTPConnectioncB@sSeZdZdZdd„Zd„Zd„Zd„Ze	d„ƒZ
d„ZRS(	sλConnect to an SMTP server and send an email.

    This is a gateway between bzrlib.config.Config and smtplib.SMTP. It
    understands the basic bzr SMTP configuration information: smtp_server,
    smtp_username, and smtp_password.
    t	localhostcC@s||_|jdkr'tj|_n||_|jdƒ|_|j|_|jdkrl|j|_n|jdƒ|_	|jdƒ|_
d|_dS(NRRR(t
_smtp_factorytNonetsmtplibtSMTPt_configtgett_config_smtp_servert_smtp_servert_default_smtp_servert_smtp_usernamet_smtp_passwordt_connection(tselfRR((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyt__init__>s		cC@s+|jdk	rdS|jƒ|jƒdS(s2If we haven't connected, connect and authenticate.N(RRt_create_connectiont
_authenticate(R((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyt_connectMs
cC@sΒ|jƒ|_y|jj|jƒWnntjk
r–}|jdtjkr|j	dkrxttj|jƒ‚q“ttj|jƒ‚q—‚nX|jj
ƒ\}}d|koΓdkns|jjƒ\}}d|koτdknstd||fƒ‚qn|jjdƒrΎ|jjƒ\}}d|koSdknsqtd||fƒ‚n|jj
ƒ\}}d|kodknsΎtd||fƒ‚qΎndS(	sCreate an SMTP connection.iiΘi+sserver refused HELO: %d %ststarttlssserver refused STARTTLS: %d %ssserver refused EHLO: %d %sN(RRtconnectRtsocketterrortargsterrnotECONNREFUSEDRRRRtehlotheloRthas_extnR (Rtetcodetresp((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyRXs.		cC@s΄tjƒ}|jdkrI|jd|jƒ|_|jdkrIdSn|jdkry|jd|j|jƒ|_ntj	|jƒ}tj	|jƒ}|j
j||ƒdS(s1If necessary authenticate yourself to the server.tsmtpN(RtAuthenticationConfigRRtget_userRRtget_passwordRt	safe_utf8Rtlogin(Rtauthtusernametpassword((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyRyscC@s—tj|jddƒƒd}g}x?dddgD].}|j|dƒ}|r5|j|ƒq5q5Wgtj|ƒD]}|d^qw}||fS(s£Get the origin and destination addresses of a message.

        :param message: A message object supporting get() to access its
            headers, like email.Message or bzrlib.email_message.EmailMessage.
        :return: A pair (from_email, to_emails), where from_email is the email
            address in the From header, and to_emails a list of all the
            addresses in the To, Cc, and Bcc headers.
        tFromitTotCctBccN(Rt	parseaddrRRtappendtgetaddresses(tmessaget
from_emailtto_full_addressestheadertvaluetpairt	to_emails((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pytget_message_addresses‘s
#cC@sΰ|j|ƒ\}}|s$t‚ny*|jƒ|jj|||jƒƒWn‹tjk
rƒ}td|j	j
ƒdƒ‚nYtjk
r΄}td|j|j
fƒ‚n(tjk
rΫ}tt|ƒƒ‚nXdS(sΨSend an email message.

        The message will be sent to all addresses in the To, Cc and Bcc
        headers.

        :param message: An email.Message or email.MIMEMultipart object.
        :return: None
        sserver refused recipient: %d %sis%d %sN(RDRRRtsendmailt	as_stringRtSMTPRecipientsRefusedRt
recipientstvaluestSMTPResponseExceptiont	smtp_codet
smtp_errort
SMTPExceptiontstr(RR=R>RCR*((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyt
send_email¦s		
N(t__name__t
__module__t__doc__RRRRRRtstaticmethodRDRO(((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyR
4s		!	(RRt
__future__RtemailRR%RR"tbzrlibRRt
bzrlib.errorsRRRRtOptionRRRRtobjectR
(((s:/usr/lib/python2.7/dist-packages/bzrlib/smtp_connection.pyt<module>s"			

Copyright © 2017 || Recoded By Mr.Bumblebee