hook_mail

Send email with an attachment without using contrib modules in Drupal 8

Mail Box
This tutotial provides code example for sending emails with an attachment without using any contrib modules in Drupal 8. We show how to properly include files's content and mime headers into message body which will become an email with an attachment by using hook_mail() and drupal mail manager.