Plenty of birds are very intelligent, with crows and ravens getting a special mention in the inventiveness department. In real life, you can train them for many things, including repeating spoken phrases (similar to how you would train a parrot). I imagine that theoretically, with enough time and patience, you could train a raven to fly regularly between two predetermined locations, or to always fly back to the same location.
It would probably take several years of one on one training per bird, and you'd be likely to lose a lot of birds along the way, since the odds that your captive raven will come back to you are pretty low, even if you've been working with that bird since the day it hatched. After all, modern falconers experience similar problems; even if you've done everything right, there's still about a good chance that the first time you let your falcon of the tether, it isn't coming back.
So let's look at this question from a different perspective. Why, in the real world, are Homing Pigeons the only kind of bird typically used for this purpose?
Because the behavior of always returning to the same place is instinctual, they require much less training, and can be trained as a flock. Further, you're far, far less likely to lose them in the process. They're also incredibly reliable. In WWI, for example, they were known to be able to get the message through to the intended location 95% of the time--not bad for the middle of a war zone. I imagine ravens, being more intelligent, would probably be less reliable, as they'd be more likely to seek shelter somewhere that wasn't getting shot at, treats be damned.
So, possible? Probably. Practical? Not really, at least not if there are other, better ways of doing things already available.