{"id":13937074,"url":"https://github.com/WoLpH/mailjet","last_synced_at":"2025-07-19T22:33:49.427Z","repository":{"id":2311286,"uuid":"3270942","full_name":"wolph/mailjet","owner":"wolph","description":"Mailjet API implementation in Python","archived":true,"fork":false,"pushed_at":"2021-12-26T03:43:08.000Z","size":98,"stargazers_count":19,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-11-11T20:20:15.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mailjet.readthedocs.org/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wolph.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-26T03:21:01.000Z","updated_at":"2023-10-12T16:28:01.000Z","dependencies_parsed_at":"2022-09-11T14:22:24.734Z","dependency_job_id":null,"html_url":"https://github.com/wolph/mailjet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolph%2Fmailjet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolph%2Fmailjet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolph%2Fmailjet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolph%2Fmailjet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wolph","download_url":"https://codeload.github.com/wolph/mailjet/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226693903,"owners_count":17667757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-07T23:03:15.502Z","updated_at":"2024-11-27T05:30:50.090Z","avatar_url":"https://github.com/wolph.png","language":"Python","funding_links":[],"categories":["资源列表","Python","Email"],"sub_categories":["电子邮件"],"readme":"\n+----------------------------------------------------------------------------+\n|                                  READ THIS FIRST!!                         |\n+============================================================================+\n| This repository isn't compatible with the current Mailjet API (v3) and, as |\n| a consequence, is considered deprecated and won't undergo further          |\n| development. As such, this repository isn't under active maintenance.      |\n+----------------------------------------------------------------------------+\n\nIntroduction\n============\n\n`Mailjet \u003chttp://www.mailjet.com\u003e`__ is a real-time Cloud Emailing\nplatform and this is a python library to access the `Mailjet Web\nAPI \u003chttps://mailjet.com/docs/api\u003e`__.\n\nInstallation\n============\n\n-  Clone this repository:\n\n``git clone https://github.com/WoLpH/mailjet``\n\n-  ``cd`` into the cloned directory and execute:\n\n``python setup.py install``.\n\nThe settings can be configured from a Django settings file through\n``MAILJET_API_KEY`` and ``MAILJET_SECRET_KEY``, or through environment\nvariables with the same name.\n\ni.e.\n\n.. code:: py\n\n    export MAILJET_API_KEY='YOUR_API_KEY'\n    export MAILJET_SECRET_KEY='YOUR_SECRET_KEY'\n\nAlternatively, you can just pass the API key and Secret key as\nparameters when initializing the mailjet API as follows:\n\n.. code:: py\n\n    import mailjet\n\n    mailjet_api = mailjet.Api(api_key='YOUR_API_KEY', secret_key='YOUR_SECRET_KEY')\n\nUsage\n=====\n\n-  To get your account and profile information:\n\n.. code:: py\n\n    import mailjet\n\n    mailjet_api = mailjet.Api(api_key='YOUR_API_KEY', secret_key='YOUR_SECRET_KEY')\n    account_info = mailjet_api.user.infos()\n\n``account_info`` would now be assigned the following python dict:\n\n.. code:: py\n\n    {\n        'status': 'OK',\n        'infos': {\n            'username': 'user@domain.com',\n            'firstname': 'firstname',\n            'locale': 'en_US',\n            'lastname': 'lastname',\n            'company_name': 'company_name',\n            'contact_phone': None,\n        }\n    }\n\n-  Create a new list of contacts, following on from the previous\n   example:\n\n.. code:: py\n\n    contact_list = mailjet_api.lists.create(\n        label='test',\n        name='testlist',  # Only alphanumeric characters are allowed!\n        method='POST'\n    )\n\n``contact_list`` will now contain a dictionary with the status and list\nid as below:\n\n.. code:: py\n\n    {\n        'status': 'OK',\n        'contact_id': 000000000\n    }\n\n-  You can now add contacts to your list using the ``contact_id``:\n\n.. code:: py\n\n    mailjet_api.lists.addcontact(\n        contact='example@example.com',\n        id=contact_list['list_id'],\n        method='POST'\n    )\n\nFAQ\n===\n\nHow do I give reserved python keywords as parameters?\n-----------------------------------------------------\n\nMethods such as creating a campaign require you to use reserved python\nkeywords, such as ``from`` - hence, in order to overcome this, do the\nfollowing:\n\n.. code:: py\n\n    params = dict()\n    params['method'] ='POST'\n    params['subject'] = 'My first campaign'\n    params['list_id'] = contact_list['list_id']\n    params['lang'] = 'en'\n    params['from'] = 'noreply@example.com'\n    params['from_name'] = 'Your name'\n    params['footer'] = 'default'\n    campaign = mailjet_api.message.createcampaign(**params)\n\nHow do I debug errors?\n----------------------\n\nThe errors produced by the ``mailjet`` library (or actually, produced by\nthe ``urllib2`` library) are still normal http responses. So if you wish\nto read the actual response, do something like this:\n\n.. code:: py\n\n    try:\n        contact_list = mailjet_api.lists.create(\n            label='test',\n            name='Test list',  # Incorrect because of the space in the name\n            method='POST'\n        )\n    except Exception, e:\n        print 'Mailjet response: %r, %r' % (e, e.read())\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWoLpH%2Fmailjet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWoLpH%2Fmailjet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWoLpH%2Fmailjet/lists"}