{ "info": { "author": "Lovely Systems", "author_email": "office@lovelysystems.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "==============================\n Lovely.Mail and Mail Testing\n==============================\n\nThis package mainly provides a simple way to test the mail delivery using the\ncurrent configuration. There is no need to change the mailing configuration\nfor the functional tests.\n\n >>> from lovely.mail import testing\n\nBefore we can set up the mail testing we need to register the mailer\nutilities.\n\n >>> from zope import component\n >>> from zope.sendmail.mailer import SMTPMailer\n >>> component.provideUtility(SMTPMailer(),\n ... name='lovely-mailer')\n\n >>> from zope.sendmail.delivery import QueuedMailDelivery\n >>> component.provideUtility(QueuedMailDelivery('some_path'),\n ... name='lovely-mail-delivery')\n\nNow we set up testing. This is the code which should go into you\nsetUp-function for your tests.\n\n >>> testing.setUpSMTPTesting('lovely-mailer', 'lovely-mail-delivery', unit_test=True)\n\nTesting simply replaces the smtp mailer of the utility to a test smtp mailer.\n\n >>> from zope.sendmail.interfaces import IMailer, IMailDelivery\n >>> mailer = component.getUtility(IMailer, 'lovely-mailer')\n >>> mailer.smtp\n \n\nAnd the mail delivery gets a temporary directory.\n\n >>> delivery = component.getUtility(IMailDelivery, 'lovely-mail-delivery')\n >>> delivery._queuePath != 'some_path'\n True\n\nTesting provides a list with already sent mails.\n\n >>> testing.sentMails\n []\n\nNow we send a mail.\n\n >>> messageId = delivery.send('README', ['MAILQUEUE',], 'I am a testing mail')\n >>> testing.sentMails\n []\n\nThe mail is not sent yet because we need to trigger mail delivery.\n\n >>> testing.triggerMail()\n >>> from pprint import pprint\n >>> pprint(testing.sentMails)\n [('README',\n ('MAILQUEUE',),\n 'Message-Id: <...>\\nI am a testing mail')]\n\n\nWe also provide a simple function to send mails.\n\n >>> from lovely.mail import sendmail\n >>> sendmail('subject', 'me@gmail.org', ['you@gmail.org'], 'my mail body')\n >>> testing.sentMails = []\n >>> testing.triggerMail()\n >>> pprint(testing.sentMails)\n [('me@gmail.org',\n ('you@gmail.org',),\n 'Message-Id: ...\\nFrom: me@gmail.org\\nTo: you@gmail.org\\n...\\nmy mail body')]\n\nIf we provide tuples for the addresses we get this :\n\n >>> sendmail('subject', ('ich', 'me@gmail.org'), [('du','you@gmail.org',)], 'my mail body')\n >>> testing.sentMails = []\n >>> testing.triggerMail()\n >>> pprint(testing.sentMails)\n [('ich ',\n ('du ',),\n 'Message-Id: ...\\nFrom: ich \\nTo: du \\n...\\nmy mail body')]\n\n\nAttachments\n-----------\n\nAttachments must be provided as a list of tuples containing a file like object\nproviding \"read\", the filename and the mime type of the attachment (if known).\n\n >>> from StringIO import StringIO\n >>> f1 = StringIO(\"I am the content of file 1\")\n >>> sendmail('subject', ('ich', 'me@gmail.org'), [('du','you@gmail.org',)],\n ... 'my mail body', attachments=[(f1, 'f1.txt', None)])\n >>> testing.sentMails = []\n >>> testing.triggerMail()\n >>> pprint(testing.sentMails)\n [('ich ',\n ('du ',),\n 'Message-Id: ...')]\n >>> pprint(testing.sentMails[0][2].split('\\n'))\n ['Message-Id: <...>',\n 'Content-Type: multipart/mixed; boundary=\"===============...==\"',\n 'MIME-Version: 1.0',\n 'Subject: subject',\n 'From: ich ',\n 'To: du ',\n 'Date: ...',\n '',\n '--===============...==',\n 'Content-Type: text/plain; charset=\"utf-8\"',\n 'MIME-Version: 1.0',\n 'Content-Transfer-Encoding: 7bit',\n '',\n 'my mail body',\n '--===============...==',\n 'Content-Type: application/octet-stream',\n 'MIME-Version: 1.0',\n 'Content-Transfer-Encoding: base64',\n 'Content-Disposition: attachment; filename=\"f1.txt\"',\n '',\n 'SS...',\n '--===============...==--']\n\n\n >>> f1.seek(0)\n >>> sendmail('subject', ('ich', 'me@gmail.org'), [('du','you@gmail.org',)],\n ... 'my mail body', attachments=[(f1, 'f1.txt', ('text','plain'))])\n >>> testing.sentMails = []\n >>> testing.triggerMail()\n >>> pprint(testing.sentMails)\n [('ich ',\n ('du ',),\n 'Message-Id: ...')]\n >>> pprint(testing.sentMails[0][2].split('\\n'))\n ['Message-Id: <...>',\n 'Content-Type: multipart/mixed; boundary=\"===============...==\"',\n 'MIME-Version: 1.0',\n 'Subject: subject',\n 'From: ich ',\n 'To: du ',\n 'Date: ...',\n '',\n '--===============...==',\n 'Content-Type: text/plain; charset=\"utf-8\"',\n 'MIME-Version: 1.0',\n 'Content-Transfer-Encoding: 7bit',\n '',\n 'my mail body',\n '--===============...==',\n 'Content-Type: text/plain; charset=\"us-ascii\"',\n 'MIME-Version: 1.0',\n 'Content-Transfer-Encoding: 7bit',\n 'Content-Disposition: attachment; filename=\"f1.txt\"',\n '',\n 'I am the content of file 1',\n '--===============...==--']\n\nAnd clean up.\n\n >>> testing.tearDownSMTPTesting()\n >>> mailer.smtp\n \n >>> delivery._queuePath == 'some_path'\n True\n >>> testing.sentMails\n []\n\n\n=======================\nChanges for lovely.mail\n=======================\n\nAfter\n=====\n\n2009/09/08 0.3.1\n================\n\n - allow the use of directMailDelivery for testing\n - handle attachments according to their type\n\n2009/07/30 0.3.0\n================\n\n - added attachments\n\n2009/04/22 0.2.0\n================\n\n - stop remaining QueueProcessThread on tearDown because python 2.5 doesn't\n terminate.\n\n2008/04/22 0.1.3\n================\n\n- make the testmailer compatible to the latest zope.sendmail package\n\n2007/12/10 0.1.2\n================\n\n- move stuff to zope.org and pypi\n\n2007/08/23 0.1.1\n================\n\n- added remotemail.py for remote sendmail tasks\n\n2007/06/20 0.1.0a1\n==================\n\n- added TestMailDelivery utility implementation\n\n- changed to current bootstrap.py\n\n- added this file\n\n- cleaned imports\n\n\nDownload\n========", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://launchpad.net/lovely.mail", "keywords": "mail zope zope3", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "lovely.mail", "package_url": "https://pypi.org/project/lovely.mail/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lovely.mail/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://launchpad.net/lovely.mail" }, "release_url": "https://pypi.org/project/lovely.mail/0.3.1/", "requires_dist": null, "requires_python": null, "summary": "sending emails via remotetask", "version": "0.3.1" }, "last_serial": 794367, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "3ed35a17ed0e1d77d87bc4b6205e49d3", "sha256": "5cffc150f9298d345531116c287b029ce803a6680f8e4d8e9ec3079e9e17ecd9" }, "downloads": -1, "filename": "lovely.mail-0.1.2-py2.4.egg", "has_sig": false, "md5_digest": "3ed35a17ed0e1d77d87bc4b6205e49d3", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 16555, "upload_time": "2007-12-10T15:08:41", "url": "https://files.pythonhosted.org/packages/4b/fd/f6c58f325e302873a30ca3b8d6ca88273979708c317aed9ed89a06816566/lovely.mail-0.1.2-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "9a5b2be5a59f39bafc968711110f9f97", "sha256": "af80ecf2d6446333ef9a02bbc450a3cbbc2453b9a7c069d3f1fd984ae789d448" }, "downloads": -1, "filename": "lovely.mail-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9a5b2be5a59f39bafc968711110f9f97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7914, "upload_time": "2007-12-10T15:08:41", "url": "https://files.pythonhosted.org/packages/33/bc/ec9259973400e727f73df6bcf72b52c2e43e39abe43e82dcb6ef65d8aa72/lovely.mail-0.1.2.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "2ce646c0f0b304f64fe78b1735f9b66c", "sha256": "e7721ec93c65ac029dbd2005e64b5fafa5081393a1c350d33d24275e88291c3d" }, "downloads": -1, "filename": "lovely.mail-0.3.1.tar.gz", "has_sig": false, "md5_digest": "2ce646c0f0b304f64fe78b1735f9b66c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9485, "upload_time": "2009-09-08T09:11:42", "url": "https://files.pythonhosted.org/packages/cd/1e/1748e3cf25db13ffd3477e93887313ff614eecd32485497403d615880b1d/lovely.mail-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2ce646c0f0b304f64fe78b1735f9b66c", "sha256": "e7721ec93c65ac029dbd2005e64b5fafa5081393a1c350d33d24275e88291c3d" }, "downloads": -1, "filename": "lovely.mail-0.3.1.tar.gz", "has_sig": false, "md5_digest": "2ce646c0f0b304f64fe78b1735f9b66c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9485, "upload_time": "2009-09-08T09:11:42", "url": "https://files.pythonhosted.org/packages/cd/1e/1748e3cf25db13ffd3477e93887313ff614eecd32485497403d615880b1d/lovely.mail-0.3.1.tar.gz" } ] }