in reply to non deliverable email

Yes, you will need the From: address to be what in you intended in order for the mail to be returned.

As for "anything special to add to the code" it is difficult for us to analyze because you aren't telling us what you are doing, nor have you provided any code for us to 'evaluate'.

I see that your other posts follow this same format and would humbly suggest you read the node How do I post a question effectively? for some general guidance and then...

Come back and provide us a bit more information about exactly what it is you are attempting that isn't working.