# How test emails?

**URL:** <https://www.ruby-forum.com/t/how-test-emails/90322>\
**Category:** Rails\
**Created:** [March 27, 2007, 8:32pm UTC](https://www.ruby-forum.com/t/how-test-emails/90322 "2007-03-27T20:32:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [March 27, 2007, 8:32pm UTC](https://www.ruby-forum.com/t/how-test-emails/90322/1 "2007-03-27T20:32:41Z")

</div>

hi, i’m writing all following TDD, but what about a mail system, how can  
i test it? how can i test that a mail has been sent? have i to use a  
mock?

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [March 27, 2007, 8:37pm UTC](https://www.ruby-forum.com/t/how-test-emails/90322/2 "2007-03-27T20:37:32Z")

</div>

david wrote:

> hi, i’m writing all following TDD, but what about a mail system, how can  
> i test it? how can i test that a mail has been sent? have i to use a  
> mock?

ActionMailer has a mock system built in. Read your test.rb and  
test\_helper.rb files, then either use it or learn from it.

–  
Phlip  
[http://c2.com/cgi/wiki?ZeekLand](http://c2.com/cgi/wiki?ZeekLand) ← NOT a blog!!

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [March 28, 2007, 1:01am UTC](https://www.ruby-forum.com/t/how-test-emails/90322/3 "2007-03-28T01:01:27Z")

</div>

Phlip wrote:

> ActionMailer has a mock system built in. Read your test.rb and  
> test\_helper.rb files, then either use it or learn from it.

do you have a link to a guide?  
thanks!

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [March 28, 2007, 2:00am UTC](https://www.ruby-forum.com/t/how-test-emails/90322/4 "2007-03-28T02:00:34Z")

</div>

On Mar 27, 6:01 pm, david [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> do you have a link to a guide?  
> thanks!

Agile Web D. with Rails, 2nd Ed. has an excellent chapter on  
testing email.

[http://pragmaticprogrammer.com/titles/rails/index.html](http://pragmaticprogrammer.com/titles/rails/index.html)

You can get just the .pdf if you want to.

Jeff
