You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use Symfony\Component\Mime\Header\UnstructuredHeader;
require __DIR__ . '/../../vendor/autoload.php';
/**
* Email Sending WITH TEMPLATE
*
* WARNING! If template is provided then subject, text, html, category and other params are forbidden.
*
* UUID of email template. Subject, text and html will be generated from template using optional template_variables.
* Optional template variables that will be used to generate actual subject, text and html from email template
*/
try {
$mailtrap = MailtrapClient::initSendingEmails(
apiKey: $_ENV['MAILTRAP_API_KEY'] #your API token from here https://mailtrap.io/api-tokens
);
$email = (new MailtrapEmail())
->from(new Address('example@YOUR-DOMAIN-HERE.com', 'Mailtrap Test')) // <--- you should use your domain here that you installed in the mailtrap.io admin area (otherwise you will get 401)