[BangPypers] Embedded python mail server
Dhananjay Nene
dhananjay.nene at gmail.com
Wed Aug 24 09:35:43 CEST 2011
On Wed, Aug 24, 2011 at 12:48 PM, Gopalakrishnan Subramani
<gopalakrishnan.subramani at gmail.com> wrote:
> fakemail seems to be right solution to me. interesting discovery.
>
Had troubles with easy_install. Colleague recommended
http://packages.python.org/lazr.smtptest/docs/queue.html
Quickly tried out in shell .. works and looks like a very appropriate tool.
Dhananjay
> On Wed, Aug 24, 2011 at 1:10 AM, Dhananjay Nene <dhananjay.nene at gmail.com>wrote:
>
>> Just discovered http://www.lastcraft.com/fakemail.php
>>
>> On Wed, Aug 24, 2011 at 12:37 PM, Dhananjay Nene
>> <dhananjay.nene at gmail.com> wrote:
>> > On Wed, Aug 24, 2011 at 12:34 PM, Dhananjay Nene
>> > <dhananjay.nene at gmail.com> wrote:
>> >> On Wed, Aug 24, 2011 at 12:25 PM, Gopalakrishnan Subramani
>> >> <gopalakrishnan.subramani at gmail.com> wrote:
>> >>> So you basically look for SMTP and also a POP3 access to the server?
>> With
>> >>> that you could send a mail using SMTP and retrieve using POP3 to make
>> sure
>> >>> the mail reached safely? There is no way to get the return receipt in
>> SMTP
>> >>> (sorry, I could be wrong since I coded SMTP & POP3 6 years back with
>> limited
>> >>> support).
>> >>
>> >> Only SMTP with programmatic access to query received emails is good
>> enough.
>> >>>
>> >>> I used jmailsrv which is simple to configure and test on your
>> scenarios.
>> >>>
>> >>> If you could share your testing strategy to test email, it would lead
>> to
>> >>> good discussion.
>> >>>
>> >>
>> >> There is an released artifact "X". X needs to be tested for acceptance
>> >> criteria. No code changes can be introduced into X. X sends out
>> >> emails. Test cases need to test whether the mails got sent out
>> >> correctly. Thus after running test sequences, the mails that have gone
>> >> out need to be verified. The intent is to embed the mail server into
>> >> the test case (not X). Thus outgoing emails from X will get dispatched
>> >> to and received by the embedded mail server. Since test cases (but not
>> >> X) have programmatic access to X and its datastore, using whatever is
>> >> the available mail server api to query the mails it has received is
>> >> acceptable mechanism of verification. Using a embedded python mail
>> >> server helps the test cases to just test the received emails using
>> >> python calls rather than having to do POP3 calls instead.
>> >>
>> > s/programmatic access to X and its datastore/programmatic access to
>> > mail server and its datastore/g
>> >> Dhananjay
>> >>
>> >>>
>> >>> On Wed, Aug 24, 2011 at 12:42 AM, Dhananjay Nene
>> >>> <dhananjay.nene at gmail.com>wrote:
>> >>>
>> >>>> On Wed, Aug 24, 2011 at 12:03 PM, Gopalakrishnan Subramani
>> >>>> <gopalakrishnan.subramani at gmail.com> wrote:
>> >>>> > Use the http://hg.python.org/cpython/file/2.7/Lib/smtpd.py server.
>> smtpd
>> >>>> is
>> >>>> > a proxy so only look at the client interface level, you may not need
>> to
>> >>>> push
>> >>>> > to local server, no need to store to DB etc.
>> >>>> >
>> >>>> > you copy the file and modify and wrap to meet your automation needs
>> and
>> >>>> to
>> >>>> > get the response confirmation once the mail delivered.
>> >>>> >
>> >>>> > SMTP RFC is very simple to code even in C++ & Java. But until or
>> unless
>> >>>> you
>> >>>> > have mail client or mail proxy or a email server as your core
>> >>>> > business/module or automating the application functional testing,
>> you
>> >>>> don't
>> >>>> > need to worry about testing with real mail server.
>> >>>> >
>> >>>> > Since you have mentioned as automated test, I assume that you don't
>> mean
>> >>>> > unit testing.
>> >>>>
>> >>>> It is automated acceptance testing .. so testing is strictly at the
>> >>>> system boundaries. So it has to test the released version of the
>> >>>> artifact - without *any* changes. I presume that would constrain me
>> >>>> from introducing a different smtpd.py
>> >>>>
>> >>>> > Gopal
>> >>>> >
>> >>>> >
>> >>>> >
>> >>>> >
>> >>>> > On Tue, Aug 23, 2011 at 11:39 PM, Dhananjay Nene
>> >>>> > <dhananjay.nene at gmail.com>wrote:
>> >>>> >
>> >>>> >> On Wed, Aug 24, 2011 at 11:06 AM, Anand Chitipothu <
>> >>>> anandology at gmail.com>
>> >>>> >> wrote:
>> >>>> >> > 2011/8/24 Dhananjay Nene <dhananjay.nene at gmail.com>:
>> >>>> >> >> What would be good options to embed a python mail server ?
>> >>>> >> >>
>> >>>> >> >> The scope is strictly restricted to automated testing. So the
>> >>>> embedded
>> >>>> >> >> mail server (embedded in the test cases) acts as the server
>> which
>> >>>> >> >> receives email and is in turn further queried to ensure receipt
>> of
>> >>>> >> >> email correctly.
>> >>>> >> >>
>> >>>> >> >> One option is http://lamsonproject.org/
>> >>>> >> >>
>> >>>> >> >> Are there any other options you might suggest?
>> >>>> >> >
>> >>>> >> > Do you really want to run a mail server for testing? I usually
>> monkey
>> >>>> >> > patch the function to send email and store the emails in a global
>> >>>> >> > variable for later access.
>> >>>> >> >
>> >>>> >>
>> >>>> >> In automated acceptance testing context I believe it would be
>> >>>> >> appropriate to implement a mail server. With unit tests, stubbing
>> the
>> >>>> >> mail server with a mock would've been fine.
>> >>>> >>
>> >>>> >> Dhananjay
>> >>>> _______________________________________________
>> >>>> BangPypers mailing list
>> >>>> BangPypers at python.org
>> >>>> http://mail.python.org/mailman/listinfo/bangpypers
>> >>>>
>> >>> _______________________________________________
>> >>> BangPypers mailing list
>> >>> BangPypers at python.org
>> >>> http://mail.python.org/mailman/listinfo/bangpypers
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >>
>> ----------------------------------------------------------------------------------------------------------------------------------
>> >> http://blog.dhananjaynene.com twitter: @dnene google plus:
>> >> http://gplus.to/dhananjaynene
>> >>
>> >
>> >
>> >
>> > --
>> >
>> ----------------------------------------------------------------------------------------------------------------------------------
>> > http://blog.dhananjaynene.com twitter: @dnene google plus:
>> > http://gplus.to/dhananjaynene
>> >
>>
>>
>>
>> --
>>
>> ----------------------------------------------------------------------------------------------------------------------------------
>> http://blog.dhananjaynene.com twitter: @dnene google plus:
>> http://gplus.to/dhananjaynene
>> _______________________________________________
>> BangPypers mailing list
>> BangPypers at python.org
>> http://mail.python.org/mailman/listinfo/bangpypers
>>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
--
----------------------------------------------------------------------------------------------------------------------------------
http://blog.dhananjaynene.com twitter: @dnene google plus:
http://gplus.to/dhananjaynene
More information about the BangPypers
mailing list