For Mail, do this:
1. Move the ~/Library/Mail folder to wherever you want it to live.
2. Make a symbolic link from the old ~/Library/Mail location, to the new location.
Do this in the Terminal by typing:
ln -s ~/Library/Mail
(with a space after Mail)
then drop the new folder from the Finder onto the Terminal. Terminal will complete the path to the folder for you.
Press return to enter the command.
3. Start up Mail and hopefully all will be well.
For iPhoto, you can set the location of your iPhoto Library in two ways:
1. Just move the library to a new location, and make a symbolic link as above.
-OR-
2. In the Terminal, type this:
defaults write com.apple.iPhoto RootDirectory /path/to/desired/location