For emotions, you need glands, which machines don't have, and I don't know how one would synthesise them.
You don't really need the glands to produce emotions, just the hormones they release, such as epinephrine (AKA adrenaline)--along with neurotransmitters such as acetylcholine, dopamine, seratonin, etc. These are simply chemicals and can certainly be isolated. It may be possible to create a computer that releases these chemicals at the result of light, touch, or other electrical stimuli. The problem is that fully experiencing the emotions generally utilizes bodily effects like sweating, heart pounding, physical pleasure, etc--and computers don't usually have that.
More importantly, the human brain and its nerves are so complex that there are literally trillions of electrical connections between all the neurons in the nervous system. Computers' electrical impulses move a lot
faster than ours do, which is why they are so good at number crunching, but our brains are infinitely more complicated. I suppose it is theoretically possible to create a supercomputer with as many electrical connections as the human body has, but I'm not sure it would ever be finished.
That's the main obstacle I see to creating a computer with intelligence and emotions. It seems to me that ultimately, our own intelligence, emotions, and even awareness are all the result of exceptional hardwiring.