Skip to content

Effortless Email with MailTo Class

The MailTo class is available for all projects configured with Vite. If you need to use it in another project, please contact your manager for guidance on proper placement.

This MailTo utility streamlines sending HTML-based emails through WordPress’s native wp_mail function. It enables you to set the recipient, subject, and message content in an organized, straightforward way, making it ideal for WordPress-based projects.

You can find the full class implementation here.

<?php
// Instantiate the MailTo class with the required parameters.
$mail = new MailTo((object) [
'email' => 'example@terrahq.com', // Recipient's email address
'subject' => 'Welcome to Terra', // Subject of the email
'message' => '<h1>Hello, World!</h1><p>Welcome to our platform.</p>', // HTML message content
]);
?>