A definition of 'emotion' is a complex experience of consciousness, sensation, and behavior reflecting the personal significance of a thing, event, or state of affairs.
Software programs can be constructed to mimic emotions over a breadth of scenarios covered by training data. That's it.
If I input written text into the program [designed/optimized for emotional response output] describing a situation or event, the software program will provide text output demonstrating an emotionally response based upon a probabilistic neural network... the accuracy and completeness of the training data, coupled with the suitability of the network design and training on data, will determine the quality of the artificial emotional response. The program will work well in many cases and will 'poop the bed' in some cases. One could train a computer vision model on crying faces, sad faces, etc. and then feed data from that CV model into a text response LLM model... so that a computer with a camera could ask you if/why your sad and respond to your answer with a mimic emotional response. Still just a really big plinko machine... 'data in' --> probabilistic output.
These programs are not conscious, do not 'feel' human sensation, and thus cannot have actual emotions (based upon definition above). These programs are just tuned probability engines. One could argue that the human mind (animal mind) is just a tuned probabilistic reasoning engine... but I think that is pretty 'reductionist'.