First, checkout this answer on the RasPi SE. https://raspberrypi.stackexchange.com/questions/1633/how-can-one-control-ac-power-220v-with-a-raspberry-pi. Avoid using Solid State relays for controlling appliances with motors (cooling fans, winches, ski-lifts, escalators, washer Spin-Cycle, etc), unless the manufacturer says it's ok. Look online for more info on how to mitigate inductive loads with solid-state relays.
I wouldn't use the PasPi pins to directly drive anything over 4mA particularly relays. Use a transistor with kick-back protection (see below).
There is also a RasPi friendly SCR daughter board that allows you to trigger 110Volts. At our local hacklab, we used one of those to trigger a Pop Machine to dispense drinks via RasPi. Works fine and everyone is so far safe.
If you're bent on triggering a mechanical relay, you can use a Power MOSFET like this one FDC6303N to trigger your relay. This FET has built-in protection diode for the inductor kick-back. just watch that your relay voltage and amperage is below the tolerance of the FET. You could use a ULN2000 series Bi-Polar transistor as well (as suggesed. I personally like FETs). There are non-surface mount versions of these as well.
Some Safety notes:
You can use a watch-dog chip to turn off the relay if the RasPi is hung or gone crazy. this means that every few seconds your RasPi will have say to the Watchdog: "I'm still sane" by doing something (send a digital message or flick a pin up/down).
I would use a somewhat-weak (50-100K) resistor to pull the controlling pin of your RasPi in the direction that turns the Relay Off (in-case your system goes to an unknown state and/or the pin floats).
- Make sure the 110-220V stuff (if on the same board) are physically far and separated.
There are examples on the RASPI site for working with the GPIO pins.
Finally, what you're trying to do could obviously be hazardous. This post will by no-means whatsoever guarantee safety and operation. I'm just sharing what I've learned in hopes that with the help of this community, you get what you want. Verify this info on your own, and make your decision at the end.
Best Answer
It might work at the moment, but you are running a risk not checking the various specs out and making sure you work within them. So I would use a transistor and the correct voltage.
I haven't used an R-pi, nor do I know the relay part number you are using, but if you are determined to go ahaead without a transistor, then what I would do is:
Read the R-pi datasheet for it's pins maximum working current, and the general advice surrounding safe use of the pins.
Measure the relay coil with a multimeter to check it's DC resistance (and read it's datasheet for other specs such as working voltage range, etc), work out the current drawn from your pin using Ohm's law. See what value resistor you would need to lower current to a safe level.
Make sure there is a reverse diode across the coil to protect the pin from kickbacks.
Having said the above, I would again really advise against trying to power a relay directly from an R-pi's pin, especially the wrong voltage.
There are loads of simple tutorials on using a transistor controlled from an IO pin to switch the relay. Even if you don't want to use a 5V supply, at the very least still use the transistor with the 3.3V supply - any general purpose one will do.
Basically, if you are running outside the specs with stuff like this, it may work, may work for a while then blow, cause seemingly unrelated issues, etc. That's why it's never a good idea to ignore them.