If you don't go with what Virgil suggested, I'd suggest NOT modifying that code you mentioned. Rather create a global handler and override anytime a mail message is sent. This way no matter where the email is sent from, it will always be captured and use the code you write integrating with SendGrid.