当前位置: 首页>>代码示例>>Python>>正文


Python SESConnection.verify_email_address方法代码示例

本文整理汇总了Python中boto.ses.SESConnection.verify_email_address方法的典型用法代码示例。如果您正苦于以下问题:Python SESConnection.verify_email_address方法的具体用法?Python SESConnection.verify_email_address怎么用?Python SESConnection.verify_email_address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boto.ses.SESConnection的用法示例。


在下文中一共展示了SESConnection.verify_email_address方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from boto.ses import SESConnection [as 别名]
# 或者: from boto.ses.SESConnection import verify_email_address [as 别名]
    def handle(self, *args, **options):

        verbosity = options.get("verbosity", 0)
        add_email = options.get("add", False)
        delete_email = options.get("delete", False)
        list_emails = options.get("list", False)

        access_key_id = getattr(settings, "AWS_ACCESS_KEY_ID", None)
        access_key = getattr(settings, "AWS_SECRET_ACCESS_KEY", None)

        connection = SESConnection(aws_access_key_id=access_key_id, aws_secret_access_key=access_key)

        if add_email:
            if verbosity != "0":
                print "Adding email: %s" % add_email
            connection.verify_email_address(add_email)
        elif delete_email:
            if verbosity != "0":
                print "Removing email: %s" % delete_email
            connection.delete_verified_email_address(delete_email)
        elif list_emails:
            if verbosity != "0":
                print "Fetching list of verified emails:"
            response = connection.list_verified_email_addresses()
            emails = response["ListVerifiedEmailAddressesResponse"]["ListVerifiedEmailAddressesResult"][
                "VerifiedEmailAddresses"
            ]
            for email in emails:
                print email
开发者ID:philipkimmey,项目名称:django-ses,代码行数:31,代码来源:ses_email_address.py

示例2: handle

# 需要导入模块: from boto.ses import SESConnection [as 别名]
# 或者: from boto.ses.SESConnection import verify_email_address [as 别名]
 def handle(self, *args, **options):
     
     verbosity = options.get('verbosity', 0)
     add_email = options.get('add', False)
     delete_email = options.get('delete', False)
     list_emails = options.get('list', False)
     
     access_key_id = getattr(settings, 'AWS_ACCESS_KEY_ID', None)
     access_key = getattr(settings, 'AWS_SECRET_ACCESS_KEY', None)
     api_endpoint = getattr(settings, 'AWS_SES_API_HOST',
                                  SESConnection.DefaultHost)
     
     connection = SESConnection(
             aws_access_key_id=access_key_id,
             aws_secret_access_key=access_key,
             host=api_endpoint,
         )
     
     if add_email:
         if verbosity != '0':
             print "Adding email: %s"  % add_email
         connection.verify_email_address(add_email)
     elif delete_email:
         if verbosity != '0':
             print "Removing email: %s" % delete_email
         connection.delete_verified_email_address(delete_email)
     elif list_emails:
         if verbosity != '0':
             print "Fetching list of verified emails:"
         response = connection.list_verified_email_addresses()
         emails = response['ListVerifiedEmailAddressesResponse']['ListVerifiedEmailAddressesResult']['VerifiedEmailAddresses']
         for email in emails:
             print email
开发者ID:Teaspiller,项目名称:django-ses,代码行数:35,代码来源:ses_email_address.py

示例3: handle

# 需要导入模块: from boto.ses import SESConnection [as 别名]
# 或者: from boto.ses.SESConnection import verify_email_address [as 别名]
    def handle(self, *args, **options):

        verbosity = options.get('verbosity', 0)
        add_email = options.get('add', False)
        delete_email = options.get('delete', False)
        list_emails = options.get('list', False)

        access_key_id = settings.ACCESS_KEY
        access_key = settings.SECRET_KEY
        region = RegionInfo(
            name=settings.AWS_SES_REGION_NAME,
            endpoint=settings.AWS_SES_REGION_ENDPOINT)

        connection = SESConnection(
                aws_access_key_id=access_key_id,
                aws_secret_access_key=access_key,
                region=region)

        if add_email:
            if verbosity != '0':
                print "Adding email: %s" % add_email
            connection.verify_email_address(add_email)
        elif delete_email:
            if verbosity != '0':
                print "Removing email: %s" % delete_email
            connection.delete_verified_email_address(delete_email)
        elif list_emails:
            if verbosity != '0':
                print "Fetching list of verified emails:"
            response = connection.list_verified_email_addresses()
            emails = response['ListVerifiedEmailAddressesResponse'][
                'ListVerifiedEmailAddressesResult']['VerifiedEmailAddresses']
            for email in emails:
                print email
开发者ID:tricoder42,项目名称:django-ses,代码行数:36,代码来源:ses_email_address.py

示例4: handle

# 需要导入模块: from boto.ses import SESConnection [as 别名]
# 或者: from boto.ses.SESConnection import verify_email_address [as 别名]
    def handle(self, *args, **options):

        verbosity = options.get('verbosity', 0)
        add_email = options.get('add', False)
        delete_email = options.get('delete', False)
        list_emails = options.get('list', False)

        access_key_id = settings.ACCESS_KEY
        access_key = settings.SECRET_KEY
        region = RegionInfo(
            name=settings.AWS_SES_REGION_NAME,
            endpoint=settings.AWS_SES_REGION_ENDPOINT)
        proxy = settings.AWS_SES_PROXY
        proxy_port = settings.AWS_SES_PROXY_PORT
        proxy_user = settings.AWS_SES_PROXY_USER
        proxy_pass = settings.AWS_SES_PROXY_PASS


        connection = SESConnection(
                aws_access_key_id=access_key_id,
                aws_secret_access_key=access_key,
                region=region,
                proxy=proxy,
                proxy_port=proxy_port,
                proxy_user=proxy_user,
                proxy_pass=proxy_pass,
        )

        if add_email:
            if verbosity != '0':
                print("Adding email: " + add_email)
            connection.verify_email_address(add_email)
        elif delete_email:
            if verbosity != '0':
                print("Removing email: " + delete_email)
            connection.delete_verified_email_address(delete_email)
        elif list_emails:
            if verbosity != '0':
                print("Fetching list of verified emails:")
            response = connection.list_verified_email_addresses()
            emails = response['ListVerifiedEmailAddressesResponse'][
                'ListVerifiedEmailAddressesResult']['VerifiedEmailAddresses']
            for email in emails:
                print(email)
开发者ID:GradConnection,项目名称:django-ses,代码行数:46,代码来源:ses_email_address.py

示例5: mailsender

# 需要导入模块: from boto.ses import SESConnection [as 别名]
# 或者: from boto.ses.SESConnection import verify_email_address [as 别名]

#.........这里部分代码省略.........
        "Content-Type",
        "Date",
        "Subject",
        "From",
        "To",
        "Bcc",
        "Cc",
        "References",
    }

    from_ = None

    h = []
    i = 0
    while i < len(headers):
        add = False
        header = headers[i][: headers[i].find(":")]
        if header in allowed:
            add = True
        if header == "From":
            from_ = headers[i][headers[i].find(":") + 1 :].strip()

        while True:
            if add:
                h.append(headers[i])
            i += 1
            if i >= len(headers) or headers[i][0] not in " \t":
                break

    mail = "\n".join(h) + mail

    # find from email
    i = from_.find("<")
    if i != -1:
        from_ = from_[i + 1 :]
        from_ = from_[: from_.find(">")]

    # logger.info("headers: %s", str(headers))
    # logger.info("h: %s", str(h))

    logger.info("Mail from %s to %s recieved", from_, to)
    # Only allow sending from altekamereren domains and registered users.
    if (
        not from_.endswith("@altekamereren.org")
        and not from_.endswith("@altekamereren.com")
        and User.objects.filter(email=from_).exists()
    ):
        logger.info("Sender not accepted.")
        return HttpResponse(status=403)

    to = to.replace(u"flojt", u"flöjt")
    reciever = to.split("@")[0]
    if reciever in ak.sections:
        user_emails = [
            user.email
            for user in User.objects.filter(instrument__in=ak.section_to_short_instruments[reciever], is_active=True)
        ]

        logger.info("Sending to section %s: %s", to, str(user_emails))

    elif reciever == u"infolistan":
        reciever = [user.email for user in User.objects.filter(is_active=True)]
        logger.info("Sending to infolistan: %s", str(reciever))
    else:
        logger.info("List not accepted.")
        return HttpResponse(status=400)

    from django.conf import settings
    from boto.ses import SESConnection
    from boto.exception import BotoServerError

    access_key_id = getattr(settings, "AWS_ACCESS_KEY_ID", None)
    access_key = getattr(settings, "AWS_SECRET_ACCESS_KEY", None)
    api_endpoint = getattr(settings, "AWS_SES_API_HOST", SESConnection.DefaultHost)
    connection = SESConnection(aws_access_key_id=access_key_id, aws_secret_access_key=access_key, host=api_endpoint)

    if not user_emails:
        return HttpResponse(status=400)

    try:
        connection.send_raw_email(mail, settings.ADMINS[0][1], user_emails)
    except BotoServerError as e:
        i = e.body.find("<Message>")
        message = e.body[i + len("<Message>") :]
        message = message[: message.find("</Message>")]

        if message == "Email address is not verified.":
            if MailVerificationSent.objects.filter(
                email=from_, sent__gte=datetime.datetime.now() - datetime.timedelta(days=1)
            ).exists():
                connection.verify_email_address(from_)
                logger.error("Sending verify mail to: %s", from_)
                MailVerificationSent(email=from_).save()
            else:
                logger.error("Verify mail already sent today: %s", from_)
            return HttpResponse(status=444)
        else:
            raise

    return HttpResponse()
开发者ID:tapetersen,项目名称:aksite,代码行数:104,代码来源:mailinglists.py


注:本文中的boto.ses.SESConnection.verify_email_address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。