Friday, July 4, 2008

Open SSL with Rails

Well I was recently working with one application and
had to configure SSL with it..
Initially I faced few problems like I was getting the following Error

no such file to load -- openssl then I searched a lot and
found the following solution

IT will be helpful to all who face the same problem or who
wants to configure Open SSL

install openssl:

./config --prefix=/usr/local --openssldir=/usr/local/ssl
make
make test
make install (as root)
./config shared --prefix=/usr/local --openssldir=/usr/local/ssl
make clean
make
make install (as root)
cd /usr/local/ssl/lib
cp * /usr/lib

To avoid getting the following error later when you compile OpenSSH:

configure: error: Your OpenSSL headers do
not match your library

copy all the SSL include files everywhere:

cd /home/tjnelson/openssl/openssl-*
cd include/openssl
cp * /usr/include
cp * /usr/local/ssl/include
cp * /usr/local/ssl/include/openssl

and then add /usr/local/ssl/lib to /etc/ld.so.conf and type

ldconfig

Then i returned to ruby-*/ext/openssl and ran:

ruby extconf.rb
make clean
make
make install

This method works perfectly

Dhaval Parikh
http://www.dhavalparikh.co.in

Tuesday, July 1, 2008

Contact List importer in rails

Well I have been hearing this question a lot..Every one wants to market about their site directly from their place..So for that these days people are integrating 3rd party services where they can import contact lists from various address books such as gmail, yahoo, aol and so on...So I integrated plaxo which rails inorder to get this functionality in my site..

Here we go

First of all load these js in views


http://www.plaxo.com/css/m/js/util.js
http://www.plaxo.com/css/m/js/basic.js
http://www.plaxo.com/css/m/js/abc_launcher.js


this will help u to open the plaxo page where u will be able to nter the login details of your desired mail account and then import all the email list

This is the controller code which u need to write for calling the send mail option

def sendemail
@emails = params[:recipients].split(',')
for email in @emails
@send = Emailer.deliver_allcontacts(email,"", "Just Test", "Dont Worry its just an testing email")
end
flash[:notice] = "Mails are successfully sent"
redirect_to :action => 'invite'
end


finally the model

def allcontacts(to,from,subject,message)
@tomail = to
@from = from
@subject = subject
@body["message"] = message
end

this will send mail to all the contacts in the list..

Thats it..Now do marketing directly from ur website..

Dhaval Parikh
Software Engineer
Ruby on Rails
http://www.dhavalparikh.co.in