load(); $dotenv->required(['MAILER_PREFIX','MAILER_PWD','MAILER_SUFFIX']); $dotenv->required('MAILER_PREFIX')->notEmpty(); $dotenv->required('MAILER_PWD')->notEmpty(); $dotenv->required('MAILER_SUFFIX')->notEmpty(); $dsn = $_ENV['MAILER_PREFIX'] . urlencode($_ENV['MAILER_PWD']) . $_ENV['MAILER_SUFFIX']; $transport = Transport::fromDsn($dsn); $mailer = new Mailer($transport); $email = (new Email()) ->from('Tester' . '<' . 'tester@example.com' .'>') ->to('hello@adamsdesk.com') ->subject('Contact Form Submission') ->text('Hello world, this is a test of the php email sender.'); $sendResult = $mailer->send($email); ?>