{ "info": { "author": "Ingeniweb", "author_email": "support@ingeniweb.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "================\niw.email package\n================\n\n.. contents::\n\nWhat is iw.email ?\n******************\n\nProvide a clean way to generate emails.\n\nHow to use iw.email ?\n*********************\n\nThere is multiple way to use iw.email. See bellow.\n\n\n\nMultipartMail\n=============\n\nThe base class of the package is the MultipartMail. You can use it to easily\ngenerate email both in html or text format with a correct encoding.\n\nWe need some html for email body::\n\n >>> umail = unicode('''\n ... corps du maiil avec caract\u00e8re unicode:\n ... utf-8: \u00e9 \u00e0 \u00ee \u00f6 \n ... cp552: \\xe2\\x80\\x93 \\xe2\\x80\\x99\n ... ''', 'utf-8')\n\n\nAnd a smtp server::\n\n >>> from smtplib import SMTP\n >>> server = SMTP('localhost')\n\nNow we can use the MultipartMail class to generate an email::\n\n >>> from iw.email import MultipartMail\n\n >>> mail = MultipartMail(html=umail,\n ... mfrom='sender@ingeniweb.com',\n ... mto='recipient@ingeniweb.com',\n ... subject=unicode('suj\u00e8\u00e9\u00e8t','utf-8'))\n\nAnd send it::\n\n >>> server.sendmail('sender@ingeniweb.com','recipient@ingeniweb.com', str(mail))\n Content-Type: multipart/related; charset=\"iso-8859-1\";\n ...\n MIME-Version: 1.0\n To: recipient@ingeniweb.com\n From: sender@ingeniweb.com\n Subject: =?iso-8859-1?q?suj=E8=E9=E8t?=\n ...\n Content-Type: multipart/mixed; charset=\"iso-8859-1\";\n ...\n Content-Type: text/html; charset=\"iso-8859-1\"\n MIME-Version: 1.0\n Content-Transfer-Encoding: quoted-printable\n \n \n corps du maiil avec caract=E8re unicode:\n utf-8: =E9 =E0 =EE =F6 =\n \n cp552: - '\n \n ...\n\n\nOk, that's cool but sometimes we want to add images.\nSo, just do it::\n\n >>> image = open(os.path.join(testdir, 'bullet.gif'))\n >>> image.read()\n 'GIF89a\\x05\\x00\\r\\x00\\x80\\x00\\x00c\\x8c\\x9c\\xff\\xff\\xff!\\xf9\\x04\\x01\\x00\\x00\\x01\\x00,\\x00\\x00\\x00\\x00\\x05\\x00\\r\\x00\\x00\\x02\\t\\x8c\\x8f\\xa9\\xbb\\xe0\\x0f\\xa3\\x84\\xa9\\x00;'\n >>> image.seek(0)\n\n >>> mail.addImage(image, filename='bullet.gif')\n >>> mail.images\n []\n >>> print mail.images[0].as_string()\n Content-Type: image/gif; name=\"bullet.gif\"\n MIME-Version: 1.0\n Content-Transfer-Encoding: base64\n Content-ID: \n \n R0lGODlhBQANAIAAAGOMnP///yH5BAEAAAEALAAAAAAFAA0AAAIJjI+pu+APo4SpADs=\n\nCheetahMail\n===========\n\nWe can also use Cheetah template to generate an email::\n\n >>> from iw.email import CheetahMail\n\nPath is the path to the cheetah template::\n\n >>> path = os.path.join(testdir, 'mail.tmpl')\n >>> print open(path).read()\n ==========\n $title\n ==========\n \n $paragraph\n \n\n\n \nWe need a few arguments::\n\n >>> umail = unicode('''\n ... corps du maiil avec caract\u00e8re unicode:\n ... utf-8: \u00e9 \u00e0 \u00ee \u00f6 \n ... cp552: \\xe2\\x80\\x93 \\xe2\\x80\\x99\n ... ''', 'utf-8')\n\nThen we can use the CheetahMail to generate an email from the template::\n\n >>> mail = CheetahMail(path=path,\n ... title='nice title',\n ... paragraph=umail,\n ... mfrom='sender@ingeniweb.com',\n ... mto='recipient@ingeniweb.com',\n ... subject=unicode('suj\u00e8\u00e9\u00e8t','utf-8'))\n >>> server.sendmail('sender@ingeniweb.com','recipient@ingeniweb.com', str(mail))\n Content-Type: multipart/related; charset=\"iso-8859-1\";\n ...\n To: recipient@ingeniweb.com\n From: sender@ingeniweb.com\n ...\n \n
\n

nice title

\n

corps du maiil avec caract=E8re unicode:\n iso-8859-1: =E9 =E0 =EE =F6\n cp552: - '

\n
\n \n \n \n ...\n\n\n\nTesting framework\n*****************\n\niw.email provide a testing framework. \n\nYou just need to use iw.email.testing.smtpSetUp() and\niw.email.testing.smtpTearDown() in your test case.\n\nThis will patch smtplib to allow you to test email sending in your doctests\nlike you can see in this document.\n\nYou can also set some environment variable to also send the generated email.\nHere is the allowed variable::\n\n TEST_MAIL: the recipient \n TEST_MAILFROM: mail from address (default to test@ingeniweb.com)\n TEST_MAILHOST: hostname of an smtp server (default to localhost)\n TEST_MAILPORT: smtp port (default to 25)\n\nIf the TEST_MAIL is set, the testing framework will try to send emails to it.\nSo you just need this command if you have a local smtp server::\n\n $ TEST_MAIL=gael@ingeniweb.com python setup.py test\n\n\n\n\nChanges\n*******\n\n1.4 (2009-08-01)\n==================\n\n - add EmailTestCase [gawel]\n\n1.3 (2008-11-28)\n================\n\n - add MakoMailTemplate [gawel]\n\n - allow to use a custom file like object for output in testing [gawel]\n\n1.2 (2008-04-17)\n================\n\n - need str(mail) in doctests [gawel]\n\n1.1\n===\n\n - raise an explicit message when no mail are provide [gawel]\n\n0.1\n===\n\n - initial version created by IngeniSkel", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/iw.email", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "iw.email", "package_url": "https://pypi.org/project/iw.email/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/iw.email/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/iw.email" }, "release_url": "https://pypi.org/project/iw.email/1.4/", "requires_dist": null, "requires_python": null, "summary": "Email utilities", "version": "1.4" }, "last_serial": 754511, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "98eabde31f3be080c6e84c90c7c65acf", "sha256": "558f30e6c76e7eea43576144675d61a5d38447eb3f4886d3dfec3b86d4c900ff" }, "downloads": -1, "filename": "iw.email-0.1-py2.4.egg", "has_sig": false, "md5_digest": "98eabde31f3be080c6e84c90c7c65acf", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 20722, "upload_time": "2008-01-04T10:32:02", "url": "https://files.pythonhosted.org/packages/de/04/2806948c92c527c4272a7af844d5ac1631d5d5770fd9193db1bf9f3c9c2e/iw.email-0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "1d67b271697bc32005049fca4b1dbb8f", "sha256": "db3c6024f696a5c80f7efe90be99af5c46e18d466b2ffa09251ecf5f7f190803" }, "downloads": -1, "filename": "iw.email-0.1.tar.gz", "has_sig": false, "md5_digest": "1d67b271697bc32005049fca4b1dbb8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13875, "upload_time": "2008-01-04T10:31:54", "url": "https://files.pythonhosted.org/packages/a8/8b/9e4210287b726fa7e2c86a2b7184087feca1d15db6d67f67a7a9f89d5d5e/iw.email-0.1.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "a62bca85b33130644125d7f12e5dd59d", "sha256": "35b3be16d9f1336425f4dc2a76032d6096e9af1f47e5bcae048fa3b1e0bfd6e2" }, "downloads": -1, "filename": "iw.email-0.2.1-py2.4.egg", "has_sig": false, "md5_digest": "a62bca85b33130644125d7f12e5dd59d", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 22292, "upload_time": "2008-01-28T14:29:51", "url": "https://files.pythonhosted.org/packages/cf/7c/6538a3fc9237bdea0b5f83f5eaac54790b160aecff4cdb1a4c427aae64a6/iw.email-0.2.1-py2.4.egg" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "846fc6414639a48d15aaf83242589c04", "sha256": "acc8ac8cf9cd579aba0e237b7efad139653662e4934949fcf572482e348a2749" }, "downloads": -1, "filename": "iw.email-0.3-py2.4.egg", "has_sig": false, "md5_digest": "846fc6414639a48d15aaf83242589c04", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 23932, "upload_time": "2008-02-06T11:24:35", "url": "https://files.pythonhosted.org/packages/c7/75/31397a7d4f59bf39c8b031c60deb025151aad30f1892e9c3aa0d65560996/iw.email-0.3-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "d00841aa73545db4dc4502bad07fe260", "sha256": "583ca57a82852ec6aa9fed28d15a84582be1ade6ef2ef2b845c423ea35129d1c" }, "downloads": -1, "filename": "iw.email-0.3.tar.gz", "has_sig": false, "md5_digest": "d00841aa73545db4dc4502bad07fe260", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17087, "upload_time": "2008-02-06T11:24:34", "url": "https://files.pythonhosted.org/packages/ab/d3/8505f16ed96a6721b0b47b4d1565abdca7cd756c7464f42f53383606c5ed/iw.email-0.3.tar.gz" } ], "0.3.1": [], "0.3dev-r7294": [], "1.0": [], "1.1": [ { "comment_text": "", "digests": { "md5": "6ff441f29ac8156e6c521e6c46e72b66", "sha256": "4a908f1de8a677c049b016b53b5c1e20c05a4d3286bf22f4cdab5047795b8673" }, "downloads": -1, "filename": "iw.email-1.1-py2.4.egg", "has_sig": false, "md5_digest": "6ff441f29ac8156e6c521e6c46e72b66", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 24831, "upload_time": "2008-03-17T12:45:23", "url": "https://files.pythonhosted.org/packages/f5/9d/cbe8ba81c0c0f789a38ec902325a4f81809be7f89a4d312071ce8686f2cd/iw.email-1.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "206f9bb03c0950e25f77ffb23ed6a73e", "sha256": "4529483cf61909e49295030d553fe27db3bf2fbdf974f0ca879dc1d79c565cf6" }, "downloads": -1, "filename": "iw.email-1.1.tar.gz", "has_sig": false, "md5_digest": "206f9bb03c0950e25f77ffb23ed6a73e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17421, "upload_time": "2008-03-17T12:45:22", "url": "https://files.pythonhosted.org/packages/a9/d3/db1ca4cbbe4b60de11ba15ea98c5a493611c4821d4e0e8f49d21599c29eb/iw.email-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "97cab3a5c3ef52dc1d5ac5e98bd989a1", "sha256": "2697977c36af0d18a26968e27e2cc7336713afe3daad42951de0168cc92d583c" }, "downloads": -1, "filename": "iw.email-1.2-py2.4.egg", "has_sig": false, "md5_digest": "97cab3a5c3ef52dc1d5ac5e98bd989a1", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 24939, "upload_time": "2008-04-17T15:19:03", "url": "https://files.pythonhosted.org/packages/22/be/09fd03d87546c3a444e0f4a19e413337915495748dfbbdab63e744bf96fe/iw.email-1.2-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "23fad3de643913b3fde630c29e7b0ede", "sha256": "a8497fd150a3972dfae08c438faee20c93d408fe470b849c4ac7d27c3e8b0e46" }, "downloads": -1, "filename": "iw.email-1.2.tar.gz", "has_sig": false, "md5_digest": "23fad3de643913b3fde630c29e7b0ede", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17611, "upload_time": "2008-04-17T15:19:03", "url": "https://files.pythonhosted.org/packages/28/58/1dd02a98e11744eeef0136e1a8ec5e710d74049d60cb308db287c2176d55/iw.email-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "9de1233760b1299912cabbab620d63d2", "sha256": "171eb3e577fda2ec3e57bff3d58ddb5b0aa3122ab7b797c9e639f984b5aa3b18" }, "downloads": -1, "filename": "iw.email-1.3.tar.gz", "has_sig": false, "md5_digest": "9de1233760b1299912cabbab620d63d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18202, "upload_time": "2008-11-28T15:59:26", "url": "https://files.pythonhosted.org/packages/1c/d3/42c3764b6d3caa91fbbbe2d0eadf428ed8b4e05cd2139011235028bd357e/iw.email-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "7d0628618318f45d64ebbbf2f58792b5", "sha256": "d00ab9dbde38184517e3e38af6b10f171bf6b80d1d2a668b91ef5ebf5310a499" }, "downloads": -1, "filename": "iw.email-1.4.tar.gz", "has_sig": false, "md5_digest": "7d0628618318f45d64ebbbf2f58792b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18345, "upload_time": "2009-08-01T22:06:06", "url": "https://files.pythonhosted.org/packages/47/4d/6c78cef0df9771f6f66a4a5ecd31098b47c717688215571adceee4d658e0/iw.email-1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7d0628618318f45d64ebbbf2f58792b5", "sha256": "d00ab9dbde38184517e3e38af6b10f171bf6b80d1d2a668b91ef5ebf5310a499" }, "downloads": -1, "filename": "iw.email-1.4.tar.gz", "has_sig": false, "md5_digest": "7d0628618318f45d64ebbbf2f58792b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18345, "upload_time": "2009-08-01T22:06:06", "url": "https://files.pythonhosted.org/packages/47/4d/6c78cef0df9771f6f66a4a5ecd31098b47c717688215571adceee4d658e0/iw.email-1.4.tar.gz" } ] }