From 2f9d5cccaab5fe82726639fc68202902fb6f97ca Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 24 Apr 2018 15:06:18 -0400 Subject: [PATCH] fixmailer --- header.php | 2 + signup/.gitignore | 2 + signup/composer.json | 5 ++ signup/composer.lock | 184 +++++++++++++++++++++++++++++++++++++++++++ signup/index.php | 73 ++++++++--------- 5 files changed, 224 insertions(+), 42 deletions(-) create mode 100644 signup/.gitignore create mode 100644 signup/composer.json create mode 100644 signup/composer.lock diff --git a/header.php b/header.php index 0c96ace..1f608a0 100644 --- a/header.php +++ b/header.php @@ -19,6 +19,8 @@ + + diff --git a/signup/.gitignore b/signup/.gitignore new file mode 100644 index 0000000..00674df --- /dev/null +++ b/signup/.gitignore @@ -0,0 +1,2 @@ +mg.key +/vendor/ diff --git a/signup/composer.json b/signup/composer.json new file mode 100644 index 0000000..4bcb86e --- /dev/null +++ b/signup/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "swiftmailer/swiftmailer": "^6.0" + } +} diff --git a/signup/composer.lock b/signup/composer.lock new file mode 100644 index 0000000..bc7ec07 --- /dev/null +++ b/signup/composer.lock @@ -0,0 +1,184 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "83b6abf6d841cdb5b1ce056b8fcfe973", + "packages": [ + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "egulias/email-validator", + "version": "2.1.4", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "8790f594151ca6a2010c6218e09d96df67173ad3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/8790f594151ca6a2010c6218e09d96df67173ad3", + "reference": "8790f594151ca6a2010c6218e09d96df67173ad3", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">= 5.5" + }, + "require-dev": { + "dominicsayers/isemail": "dev-master", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "time": "2018-04-10T10:11:19+00:00" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.0.2", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "412333372fb6c8ffb65496a2bbd7321af75733fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/412333372fb6c8ffb65496a2bbd7321af75733fc", + "reference": "412333372fb6c8ffb65496a2bbd7321af75733fc", + "shasum": "" + }, + "require": { + "egulias/email-validator": "~2.0", + "php": ">=7.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.0-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "http://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2017-09-30T22:39:41+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/signup/index.php b/signup/index.php index eb66b94..201d56b 100644 --- a/signup/index.php +++ b/signup/index.php @@ -1,26 +1,18 @@ - - - - - - - - - signup~tilde.team + - - - - - +$pw = file_get_contents("mg.key"); - - +$transport = (new Swift_SmtpTransport('smtp.mailgun.org', 465, 'ssl')) + ->setUsername('postmaster@mg.tilde.team') + ->setPassword($pw); +$mailer = new Swift_Mailer($transport); + +$additional_head = ''; +include __DIR__.'/../header.php'; +?> - -

tilde.team signup @@ -66,29 +58,28 @@ } if ($message == "") { - $headers = "From: {$_REQUEST["username"]} <{$_REQUEST["email"]}>\n"; - $headers .= "Sender: www-data@tilde.team\n"; - $headers .= "To: admin@tilde.team\n"; - $headers .= "Reply-To: {$_REQUEST["email"]}\n"; - $headers .= "MIME-Version: 1.0\r\n"; - $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; - $forwardmail = $_REQUEST["forward_email"] == "on" ? 'yes' : "no"; + $forwardmail = $_REQUEST["forward_email"] == "on" + ? 'yes' : "no"; - $msgbody = "

New tilde.team signup

+ $msgbody = "

tilde.team signup


- Desired username: {$_REQUEST["username"]}
- Contact email: {$_REQUEST["email"]}
- Reason: {$_REQUEST["interest"]}
- Forward mail?: $forwardmail
- SSH Key:
{$_REQUEST["sshkey"]}
"; + desired username: {$_REQUEST["username"]}
+ contact email: {$_REQUEST["email"]}
+ reason: {$_REQUEST["interest"]}
+ forward mail?: $forwardmail
+ ssh key:
{$_REQUEST["sshkey"]}
"; - if (mail('bharrismac@gmail.com', 'tilde.team signup', $msgbody, $headers)) { - echo ''; - } else { - echo 'The email has failed! Send me a message manually at ben@tilde.team'; - } + $message = (new Swift_Message('tilde.team signup')) + ->setFrom(['sys@tilde.team' => 'tilde']) + ->setTo(['admin@tilde.team']) + ->setReplyTo([$_REQUEST["email"]]) + ->setBody($msgbody, 'text/html'); + + $result = $mailer->send($message); + + echo ''; } else { ?>