I am building a module. I need to modify the Magento2 email but I cannot send email in my localhost. Is there anyway to send email or to preview magento email in my localhost?
To start sending emails from local machine. You could either install a mailing server on your machine like SMTP/Postfix and do the complete configuration process.
Or you can simply download this extension and configure for your email account. https://www.mageplaza.com/magento-2-smtp
Configuration Process: https://www.mageplaza.com/blog/configure-gmail-smtp-magento-2.html
Hope it was helpfull.
You can send email from localhost using the SMTP Extensions. Below are the some of free extension :
How to set up SMTP Email for Magento 2 > https://www.mageplaza.com/blog/how-to-set-up-smtp-email-for-magento-2.html
Hope this helps!