db script and email url changes

1. db script updated ( converted to all lower case ).
2. Corrected email url to have the hostname and context path from
request rather than hard coded to localhost