Initial commit

This commit is contained in:
Adam 2022-12-03 23:41:35 -06:00
commit c59ae6abcc
4 changed files with 1475 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.env
/node_modules/
vendor/

6
composer.json Normal file
View File

@ -0,0 +1,6 @@
{
"require": {
"symfony/mailer": "^6.2",
"vlucas/phpdotenv": "^5.5"
}
}

1440
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

26
mailer.php Normal file
View File

@ -0,0 +1,26 @@
<?php
require_once 'vendor/autoload.php';
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mime\Email;
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->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);
// $pwd = urlencode('oALj/+F*b#).n&3i>{A>_x[nbk(k97~2');
// $transport = Transport::fromDsn('smtp://noreply@adamsdesk.com:' . $pwd . '@pariah.cirrushosting.com:465?verify_peer=0');
$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);
?>