Initial commit
This commit is contained in:
commit
c59ae6abcc
|
@ -0,0 +1,3 @@
|
|||
.env
|
||||
/node_modules/
|
||||
vendor/
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"require": {
|
||||
"symfony/mailer": "^6.2",
|
||||
"vlucas/phpdotenv": "^5.5"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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);
|
||||
?>
|
Loading…
Reference in New Issue