Configuring Java Email Server for use with Rails

Configuring Java Email Server for use with Rails is easy, it’s pretty straight forward and simple.

Step 1: Install Java Email Server.

Step 2: Edit your development.rb like this :

config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.server_settings = {
:address => "sazwqa@localhost" ,
:port => 25,
:domain => "localhost" ,
:authentication => :login,
:user_name => "sazwqa" ,
:password => "******"
}

Step 3: Test your app ! voila, it runs !!!

Edit: I found that it proved to be a hit and trial method to configure rails for use with Java Mail Server, so I do suggest you do try a various settings before panicking, like in my case I wasn’t able to use the settings above on the same PC again, so I simply removed all the settings , leaving the conf like this:

config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true

and voila, it ran !

Running POP and SMTP server on local machine

It’s quite a common scenario that your program sends and receives mail, but how do you test that on your local machine ?

Well there is a solution : Java E-Mail Server

This is a simple mail server that runs POP and SMTP server on localhost and allows user to test their mail capabilities on the fly.

Configuring Java E-Mail Server is easy and you just have to define the mail storage path and the username you want to use.

Follow

Get every new post delivered to your Inbox.