示例#1
0
文件: smtp.py 项目: sgricci/digsby
 def __init__(self, **options):
     d = self.default
     self.smtp_server       = options.get('smtp_server', d('smtp_server'))
     self.smtp_require_ssl  = options.get('smtp_require_ssl', d('smtp_require_ssl'))
     self.smtp_port         = options.get('smtp_port', d('smtp_port'))
     self.smtp_username     = options.get('smtp_username', d('smtp_username'))
     self._email_address    = options.get('email_address', d('email_address'))
     self._encrypted_smtppw = profile.crypt_pw(options.get('smtp_password', d('smtp_password')))
     self._encrypted_pw     = options.pop('password')
     EmailAccount.__init__(self, password=self.password, **options)
示例#2
0
 def __init__(self, **options):
     d = self.default
     self.smtp_server = options.get("smtp_server", d("smtp_server"))
     self.smtp_require_ssl = options.get("smtp_require_ssl", d("smtp_require_ssl"))
     self.smtp_port = options.get("smtp_port", d("smtp_port"))
     self.smtp_username = options.get("smtp_username", d("smtp_username"))
     self._email_address = options.get("email_address", d("email_address"))
     self._encrypted_smtppw = profile.crypt_pw(options.get("smtp_password", d("smtp_password")))
     self._encrypted_pw = options.pop("password")
     EmailAccount.__init__(self, password=self.password, **options)
示例#3
0
 def _get_options(self):
     opts = EmailAccount._get_options(self)
     opts.update(
         dict(
             (a, getattr(self, a))
             for a in "smtp_server smtp_port smtp_require_ssl smtp_username email_address".split()
         )
     )
     return opts
示例#4
0
    def update_info(self, **info):
        if not self.isflagged(NETWORK_FLAG):
            if "smtp_password" in info:
                self._encrypted_smtppw = profile.crypt_pw(info.pop("smtp_password"))

                if "password" in info:
                    self._encrypted_pw = info["password"]

            if "_encrypted_pw" in info and "_encrypted_smtppw" in info:
                self._encrypted_pw = info.pop("_encrypted_pw")
                self._encrypted_smtppw = info.pop("_encrypted_smtppw")

            info["password"] = self._glue_pw(self._encrypted_pw, self._encrypted_smtppw)
        else:
            self.password = info.pop("password")

        log.info("smtp update_info: %r", info)
        EmailAccount.update_info(self, **info)
示例#5
0
文件: smtp.py 项目: sgricci/digsby
    def update_info(self, **info):
        if not self.isflagged(NETWORK_FLAG):
            if 'smtp_password' in info:
                self._encrypted_smtppw = profile.crypt_pw(info.pop('smtp_password'))

                if 'password' in info:
                    self._encrypted_pw = info['password']

            if '_encrypted_pw' in info and '_encrypted_smtppw' in info:
                self._encrypted_pw = info.pop('_encrypted_pw')
                self._encrypted_smtppw = info.pop('_encrypted_smtppw')

            info['password'] = self._glue_pw(self._encrypted_pw, self._encrypted_smtppw)
        else:
            self.password = info.pop('password')

        log.info("smtp update_info: %r", info)
        EmailAccount.update_info(self, **info)
示例#6
0
文件: gmail.py 项目: niterain/digsby
    def __init__(self, **k):
        EmailAccount.__init__(self, **k)
        self.internal_token = ""
        self.external_token = ""
        self.token_lock = threading.RLock()
        self.datatoken = ""
        self.updated_emails = None
        self.updated_count = None
        self.update_lock = Lock()
        self.emailaddress = EmailAddress(self.name, "gmail.com")
        self._hosted = None
        self._multi = None

        if self.emailaddress.domain in ("gmail.com", "googlemail.com"):
            self.baseMailUrl = "://mail.google.com/mail/"
        else:
            self.baseMailUrl = "://mail.google.com/a/" + self.emailaddress.domain + "/"

        self.browser_http = "https"

        self.init_jar()
示例#7
0
    def __init__(self, **k):
        EmailAccount.__init__(self, **k)
        self.internal_token = ''
        self.external_token = ''
        self.token_lock = threading.RLock()
        self.datatoken = ''
        self.updated_emails = None
        self.updated_count = None
        self.update_lock = Lock()
        self.emailaddress = EmailAddress(self.name, 'gmail.com')
        self._hosted = None
        self._multi = None

        if self.emailaddress.domain in ('gmail.com', 'googlemail.com'):
            self.baseMailUrl = '://mail.google.com/mail/'
        else:
            self.baseMailUrl = '://mail.google.com/a/' + self.emailaddress.domain + '/'

        self.browser_http = 'https'

        self.init_jar()
示例#8
0
    def __init__(self, **k):
        EmailAccount.__init__(self, **k)
        self.internal_token = ''
        self.external_token = ''
        self.token_lock = threading.RLock()
        self.datatoken = ''
        self.updated_emails = None
        self.updated_count = None
        self.update_lock = Lock()
        self.emailaddress = EmailAddress(self.name, 'gmail.com')
        self._hosted = None
        self._multi = None

        if self.emailaddress.domain in ('gmail.com', 'googlemail.com'):
            self.baseMailUrl = '://mail.google.com/mail/'
        else:
            self.baseMailUrl = '://mail.google.com/a/' + self.emailaddress.domain + '/'

        self.browser_http = 'https'

        self.init_jar()
示例#9
0
文件: gmail.py 项目: niterain/digsby
 def delete(self, email):
     EmailAccount.delete(self, email)
     self._do_action("delete", email)
示例#10
0
 def update(self):
     log.info("update at %s", time.ctime(time.time()))
     EmailAccount.update(self)
     self.real_update(success=self.finish_update, error=self.on_error)
示例#11
0
 def update(self):
     log.info("update at %s", time.ctime(time.time()))
     EmailAccount.update(self)
     self.real_update(success = self.finish_update, error=self.on_error)
示例#12
0
 def delete(self, email):
     EmailAccount.delete(self, email)
     self._do_action('delete', email)
示例#13
0
 def markAsRead(self, email):
     EmailAccount.markAsRead(self, email)
     self._do_action('read', email)
示例#14
0
        )
        return opts

    @classmethod
    def from_net(cls, info):
        password = info.password  # IS BOTH, NEEDS TO BE ONE
        try:
            encrypted_pw, encrypted_smtppw = cls._unglue_pw(password)
        except Exception, e:
            traceback.print_exc()
            assert SMTP_UPGRADING
            encrypted_pw = password
            encrypted_smtppw = u""
        info.password = encrypted_pw
        smtppw = profile.plain_pw(encrypted_smtppw)
        return EmailAccount.from_net(info, smtp_password=smtppw)

    @threaded
    def send_email(self, to="", subject="", body="", cc="", bcc=""):
        un = self.smtp_username or self.username
        f = self.from_name
        password = self._decrypted_smtppw() or (self._decryptedpw() if not self.smtp_username else "")
        srv = self.smtp_server
        if srv in ("smtp.aol.com", "smtp.aim.com"):
            if un.endswith("aol.com") or un.endswith("aim.com"):
                f = un
            else:
                f = un + u"@aol.com"
        s = SMTPsender(un, password, srv, from_name=f, use_tls=self.smtp_require_ssl)
        s.send_email(to=to, subject=subject, body=body, cc=cc, bcc=bcc)
示例#15
0
文件: smtp.py 项目: sgricci/digsby
 def _get_options(self):
     opts = EmailAccount._get_options(self)
     opts.update(dict((a, getattr(self, a)) for a in
         'smtp_server smtp_port smtp_require_ssl smtp_username email_address'.split()))
     return opts
示例#16
0
 def markAsRead(self, email):
     EmailAccount.markAsRead(self, email)
     self._do_action('read', email)
示例#17
0
    def archive(self, email):
        EmailAccount.archive(self, email)
        self._do_action('archive', email)

        if pref('gmail.markive', False):
            self.markAsRead(email)
示例#18
0
    def archive(self, email):
        EmailAccount.archive(self, email)
        self._do_action('archive', email)

        if pref('gmail.markive', False):
            self.markAsRead(email)
示例#19
0
 def reportSpam(self, email):
     EmailAccount.reportSpam(self, email)
     self._do_action('spam', email)
示例#20
0
 def delete(self, email):
     EmailAccount.delete(self, email)
     self._do_action('delete', email)
示例#21
0
 def reportSpam(self, email):
     EmailAccount.reportSpam(self, email)
     self._do_action('spam', email)
示例#22
0
文件: smtp.py 项目: sgricci/digsby
            'smtp_server smtp_port smtp_require_ssl smtp_username email_address'.split()))
        return opts

    @classmethod
    def from_net(cls, info):
        password = info.password #IS BOTH, NEEDS TO BE ONE
        try:
            encrypted_pw, encrypted_smtppw = cls._unglue_pw(password)
        except Exception, e:
            traceback.print_exc()
            assert SMTP_UPGRADING
            encrypted_pw = password
            encrypted_smtppw = u''
        info.password = encrypted_pw
        smtppw = profile.plain_pw(encrypted_smtppw)
        return EmailAccount.from_net(info, smtp_password=smtppw)

    @threaded
    def send_email(self, to='', subject='', body='', cc='', bcc=''):
        un  = self.smtp_username or self.username
        f   = self.from_name
        password   = self._decrypted_smtppw() or (self._decryptedpw() if not self.smtp_username else '')
        srv = self.smtp_server
        if srv in ("smtp.aol.com", "smtp.aim.com"):
            if un.endswith('aol.com') or un.endswith('aim.com'):
                f = un
            else:
                f = un + u'@aol.com'
        s = SMTPsender(un, password, srv, from_name=f, use_tls=self.smtp_require_ssl)
        s.send_email(to=to, subject=subject, body=body, cc=cc, bcc=bcc)