Ok, I am going to make some assumptions.
1) You have a data flow task that is writing your data to two text files (X and Y records)
2) You want to send the email message when there are Y records and attach the Y file
With that out of the way, add a global variable (of type INT) to your package.
In the end of your data flow task - just before the destination component writing the Y file, add a COUNT transformation.
Set the COUNT transformation to update the variable.
In the control flow of the package, connect your sendmail task to your data flow task.
Now, open the connector and set the flow to require "Success" AND @YourVariable!=0
I hope you followed all of that.