Added random word alias test

This commit is contained in:
Will Browning 2020-01-10 14:27:09 +00:00
parent 10aa16cebe
commit fe6a13b5ba
11 changed files with 471 additions and 171 deletions

View file

@ -8,7 +8,7 @@ This is the source code for self-hosting AnonAddy.
AnonAddy is short for "Anonymous Email Address". The word "Addy" is internet slang for email address, e.g.
> "My email addy is being spammed. I should've kept it private."
> "My addy is being spammed. I should've kept it private."
#### **Why did you make this site?**
@ -42,7 +42,7 @@ No I definitely do not store/save any emails that pass through the server.
#### **Can I use my own domain?**
Yes you can use your own domain name so you can also have *@example.com as your aliases. To do so you simply need to add an MX record to your domain so that our server can handle incoming emails.
Yes you can use your own domain name so you can also have *@example.com as your aliases. To do so you simply need to add a TXT record to verify your ownership of the domain. Then you will need to add an MX record to your domain so that our server can handle incoming emails. You can then add a few other records to enable sending from your domain too.
#### **Why should I use this instead of a similar service?**
@ -56,13 +56,13 @@ Here are a few reasons I can think of:
* No limitation on the number of aliases that can be created
* Generous monthly bandwidth
* Multiple domains to choose for aliases (currently anonaddy.com, anonaddy.me and another for paid plan users)
* Ability to generate UUID and random word aliases
* Ability to generate UUID and random word aliases at shared domains
* Ability to add additional usernames to compartmentalise aliases
* New features added regularly
#### **Is there a browser extension?**
Yes there is an [open-source](https://github.com/anonaddy/browser-extension) browser extension available to download for [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/anonaddy/) and [Chrome](https://chrome.google.com/webstore/detail/anonaddy/iadbdpnoknmbdeolbapdackdcogdmjpe) (also available on other chromium based browsers such as Brave and Vivaldi). You can use the extension to generate UUID aliases remotely.
Yes there is an [open-source](https://github.com/anonaddy/browser-extension) browser extension available to download for [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/anonaddy/) and [Chrome](https://chrome.google.com/webstore/detail/anonaddy/iadbdpnoknmbdeolbapdackdcogdmjpe) (also available on other chromium based browsers such as Brave and Vivaldi). You can use the extension to generate new aliases remotely.
#### **How do I add my own GPG/OpenPGP key for encryption?**
@ -84,7 +84,7 @@ The fingerprint of the mailer@anonaddy.me key is "26A987650243B28802524E2F809FD0
If you're concerned that your aliases are all linked by your username e.g. @johndoe.anonaddy.com, then you have a couple of options:
1. You can generate UUID or random word aliases instead, these are all under the root domain and cannot be linked to a user.
1. You can generate UUID or random word aliases instead, these are all under a shared domain and cannot be linked to a user.
2. You can add additional usernames and separate your aliases under your these. e.g. you could have one username for personal stuff, another for work, another for hobbies etc.
#### **Where is the server located?**
@ -115,6 +115,16 @@ When you delete your account the following happens:
Yes this will work with any provider, althought I can't guarantee it won't land in spam initially.
#### **How do I reply to a forwarded email?**
Each forwarded email has a Reply-To: header set. This header will look something like this:
Reply-To: "sender@example.com" <alias+59fhbf7f1ea374c9182ac0f269m3192501fep210@johndoe.anonaddy.com>
Where sender@example.com is the address of the person who sent you the email and the part between the '<' '>' is the alias (alias@johndoe.anonaddy.com in this case) that forwarded the email along with a "hash" added as an extension after the "+". In order to reply successfully you must keep this entire email address and display name intact, do not remove the "sender@example.com" display name part.
To check if a reply has worked properly check in your dashboard if the reply count has been incremented for that alias.
#### **Will people see my real email if I reply to a forwarded one?**
No, your real email will not be shown, the email will look as if it has come from us instead. Just make sure not to include anything that might identify you when composing the reply, i.e. your full name.
@ -138,7 +148,7 @@ A few days before your billing cycle ends you will receive an email letting you
* If you have any more than **2 recipients** they will be **deleted**
* Paid account settings will be reverted to default values
* Any aliases using paid plan only domains will be **deactivated**
* If you have any more than 20 aliases using a shared domain they will be **deactivated**
* If you have any more than 20 aliases using a shared domain e.g. anonaddy.me they will be **deactivated**
You will not be able to activate any of the above again until you resubscribe.
@ -161,7 +171,7 @@ The server is running a local DNS caching server to improve the speed of queries
Not unless you are really going to town. Each user is throttled to 200 emails per hour through the server.
#### **Is there a limit to how many aliases I can create?**
#### **Is there a limit to how many aliases I can create per hour?**
Currently you are limited to creating 10 new aliases per hour on the free plan, 20 per hour on the Lite plan and 50 per hour on the Pro plan. If you try to create more than this the emails will be deferred until you are back below the limit.
@ -179,7 +189,7 @@ The average email is about 76800 bytes (75KB), this is roughly equivalent to 7,0
#### **What happens if I go over my bandwidth limit in a given month?**
If you get close to your limit you'll be sent an email letting you know. If you continue and go over your limit the server will start discarding emails until your bandwidth resets the next month.
If you get close to your limit you'll be sent an email letting you know. If you continue and go over your limit the server will start discarding emails until your bandwidth resets the next month or you upgrade your plan.
#### **Can I login using an additional username?**
@ -187,15 +197,15 @@ You can add 1 additional username as a Lite user and up to 3 additional username
#### **I'm not receiving any emails, what's wrong?**
Please make sure to add mailer@anonaddy.me to your address book and check your spam folder. Make sure to mark emails from us as safe if they turn up in spam.
Please make sure to add mailer@anonaddy.me and any other aliases you use to your address book and also to check your spam folder. Make sure to mark emails from us as safe if they turn up in spam.
If an alias has been previously deleted and you try to send email to it, the emails will bounce with an error message - "554 5.7.1 Recipient address rejected: Access denied".
If an alias has been previously deleted and you try to send email to it, the emails will be rejected with an error message - "554 5.7.1 Recipient address rejected: Access denied".
Check that you have not deactivated the alias, custom domain or additional username. When any of these are deactivated, emails will be silently discarded, they will not bounce or return any error message.
Check that you have not deactivated the alias, custom domain or additional username. When any of these are deactivated, emails will be silently discarded, they will not be rejected or return any error message.
The sender of the email may be failing SPF, DMARC or DNS blacklist checks resulting in the email being rejected. The sender should also have correct reverse DNS setup and use a FQDN as their hostname.
If you are forwarding emails to an icloud.com email address some users are having issues with a small number of emails bouncing (often those from Facebook).
If you are forwarding emails to an icloud.com email address some users are having issues with a small number of emails being rejected (often those from Facebook).
For some reason Apple seems to think these emails are spam and returns this error message:
@ -223,7 +233,7 @@ My name is Will Browning, I'm a web developer from the UK and an advocate for on
#### **I couldn't find an answer to my question, how can I contact you?**
For any other questions just send an email to - [contact@anonaddy.com](mailto:contact@anonaddy.com) ([5FCAFD8A67D2A783CFF4D0E31AC6D923E6FB4EF7](https://keys.openpgp.org/search?q=5FCAFD8A67D2A783CFF4D0E31AC6D923E6FB4EF7))
For any other questions just send an email to - [contact@anonaddy.com](mailto:contact@anonaddy.com) ([GPG Key](https://anonaddy.com/anonaddy-contact-public-key.asc))
## Self Hosting

View file

@ -106,11 +106,15 @@ class ReceiveEmail extends Command
$aliasable = $customDomain;
}
// Check if this is a uuid generated alias.
// check if this is a uuid generated alias
if ($alias = Alias::find($recipient['local_part'])) {
$user = $alias->user;
} elseif ($recipient['domain'] === $parentDomain && !empty(config('anonaddy.admin_username'))) {
$user = User::where('username', config('anonaddy.admin_username'))->first();
} elseif ($recipient['domain'] === $parentDomain) {
if ($alias = Alias::where('email', $recipient['local_part'] . '@' . $recipient['domain'])->first()) {
$user = $alias->user;
} elseif (!empty(config('anonaddy.admin_username'))) {
$user = User::where('username', config('anonaddy.admin_username'))->first();
}
}
}

View file

@ -2,10 +2,13 @@
namespace App\Http\Controllers\Api;
use App\AdditionalUsername;
use App\Domain;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreAliasRequest;
use App\Http\Requests\UpdateAliasRequest;
use App\Http\Resources\AliasResource;
use Illuminate\Support\Str;
use Ramsey\Uuid\Uuid;
class AliasController extends Controller
@ -45,6 +48,27 @@ class AliasController extends Controller
];
}
// TODO update
// Check if domain is for additional username or custom domain
$parentDomain = collect(config('anonaddy.all_domains'))
->filter(function ($name) use ($request) {
return Str::endsWith($request->domain, $name);
})
->first();
$subdomain = substr($request->domain, 0, strrpos($request->domain, '.'.$parentDomain));
if ($additionalUsername = AdditionalUsername::where('username', $subdomain)->first()) {
$aliasable = $additionalUsername;
} elseif ($customDomain = Domain::where('domain', $request->domain)->first()) {
$aliasable = $customDomain;
} else {
$aliasable = null;
}
$data['aliasable_id'] = $aliasable->id ?? null;
$data['aliasable_type'] = $aliasable ? 'App\\'.class_basename($aliasable) : null;
$data['domain'] = $request->domain;
$data['description'] = $request->description;

View file

@ -14,7 +14,8 @@ class ShowAliasController extends Controller
'totalBlocked' => user()->totalEmailsBlocked(),
'totalReplies' => user()->totalEmailsReplied(),
'domain' => user()->username.'.'.config('anonaddy.domain'),
'bandwidthMb' => user()->bandwidth_mb
'bandwidthMb' => user()->bandwidth_mb,
'domainOptions' => user()->domainOptions()
]);
}
}

View file

@ -28,7 +28,7 @@ class StoreAliasRequest extends FormRequest
'domain' => [
'required',
'string',
Rule::in(config('anonaddy.all_domains'))
Rule::in($this->user()->domainOptions())
],
'description' => 'nullable|max:100',
'uuid' => 'nullable|boolean'

View file

@ -295,4 +295,22 @@ class User extends Authenticatable implements MustVerifyEmail
->random(2)
->implode('.').mt_rand(0, 999);
}
public function domainOptions()
{
$customDomains = $this->domains()->pluck('domain')->toArray();
return $this->additionalUsernames()
->pluck('username')
->push($this->username)
->flatMap(function ($username) {
return collect(config('anonaddy.all_domains'))->map(function ($domain) use ($username) {
return $username.'.'.$domain;
});
})
->concat($customDomains)
->concat(config('anonaddy.all_domains'))
->reverse()
->values();
}
}

446
composer.lock generated
View file

@ -628,16 +628,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.13",
"version": "2.1.14",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "834593d5900615639208417760ba6a17299e2497"
"reference": "c4b8d12921999d8a561004371701dbc2e05b5ece"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/834593d5900615639208417760ba6a17299e2497",
"reference": "834593d5900615639208417760ba6a17299e2497",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c4b8d12921999d8a561004371701dbc2e05b5ece",
"reference": "c4b8d12921999d8a561004371701dbc2e05b5ece",
"shasum": ""
},
"require": {
@ -681,53 +681,7 @@
"validation",
"validator"
],
"time": "2019-12-30T08:14:25+00:00"
},
{
"name": "erusev/parsedown",
"version": "1.7.4",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"time": "2019-12-30T22:54:17+00:00"
"time": "2020-01-05T14:11:20+00:00"
},
{
"name": "fideloper/proxy",
@ -1177,27 +1131,164 @@
"time": "2018-09-29T18:48:56+00:00"
},
{
"name": "laravel/framework",
"version": "v6.9.0",
"name": "laminas/laminas-diactoros",
"version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "60610be97ca389fa4b959d4d13fb3690970d9fb7"
"url": "https://github.com/laminas/laminas-diactoros.git",
"reference": "95178c4751d737cdf9ab0a9f70a42754ac860e7b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/60610be97ca389fa4b959d4d13fb3690970d9fb7",
"reference": "60610be97ca389fa4b959d4d13fb3690970d9fb7",
"url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/95178c4751d737cdf9ab0a9f70a42754ac860e7b",
"reference": "95178c4751d737cdf9ab0a9f70a42754ac860e7b",
"shasum": ""
},
"require": {
"laminas/laminas-zendframework-bridge": "^1.0",
"php": "^7.1",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"conflict": {
"phpspec/prophecy": "<1.9.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"replace": {
"zendframework/zend-diactoros": "self.version"
},
"require-dev": {
"ext-curl": "*",
"ext-dom": "*",
"ext-libxml": "*",
"http-interop/http-factory-tests": "^0.5.0",
"laminas/laminas-coding-standard": "~1.0.0",
"php-http/psr7-integration-tests": "dev-master",
"phpunit/phpunit": "^7.5.18"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev",
"dev-develop": "2.2.x-dev",
"dev-release-1.8": "1.8.x-dev"
}
},
"autoload": {
"files": [
"src/functions/create_uploaded_file.php",
"src/functions/marshal_headers_from_sapi.php",
"src/functions/marshal_method_from_sapi.php",
"src/functions/marshal_protocol_version_from_sapi.php",
"src/functions/marshal_uri_from_sapi.php",
"src/functions/normalize_server.php",
"src/functions/normalize_uploaded_files.php",
"src/functions/parse_cookie_header.php",
"src/functions/create_uploaded_file.legacy.php",
"src/functions/marshal_headers_from_sapi.legacy.php",
"src/functions/marshal_method_from_sapi.legacy.php",
"src/functions/marshal_protocol_version_from_sapi.legacy.php",
"src/functions/marshal_uri_from_sapi.legacy.php",
"src/functions/normalize_server.legacy.php",
"src/functions/normalize_uploaded_files.legacy.php",
"src/functions/parse_cookie_header.legacy.php"
],
"psr-4": {
"Laminas\\Diactoros\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "PSR HTTP Message implementations",
"homepage": "https://laminas.dev",
"keywords": [
"http",
"laminas",
"psr",
"psr-7"
],
"time": "2020-01-07T19:39:26+00:00"
},
{
"name": "laminas/laminas-zendframework-bridge",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-zendframework-bridge.git",
"reference": "0fb9675b84a1666ab45182b6c5b29956921e818d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/0fb9675b84a1666ab45182b6c5b29956921e818d",
"reference": "0fb9675b84a1666ab45182b6c5b29956921e818d",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev",
"dev-develop": "1.1.x-dev"
},
"laminas": {
"module": "Laminas\\ZendFrameworkBridge"
}
},
"autoload": {
"files": [
"src/autoload.php"
],
"psr-4": {
"Laminas\\ZendFrameworkBridge\\": "src//"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Alias legacy ZF class names to Laminas Project equivalents.",
"keywords": [
"ZendFramework",
"autoloading",
"laminas",
"zf"
],
"time": "2020-01-07T22:58:31+00:00"
},
{
"name": "laravel/framework",
"version": "v6.10.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "fe45ad5bc89e5e1b08ab2c8687f9be01c9c84d14"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/fe45ad5bc89e5e1b08ab2c8687f9be01c9c84d14",
"reference": "fe45ad5bc89e5e1b08ab2c8687f9be01c9c84d14",
"shasum": ""
},
"require": {
"doctrine/inflector": "^1.1",
"dragonmantank/cron-expression": "^2.0",
"egulias/email-validator": "^2.1.10",
"erusev/parsedown": "^1.7",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"league/commonmark": "^1.1",
"league/commonmark-ext-table": "^2.1",
"league/flysystem": "^1.0.8",
"monolog/monolog": "^1.12|^2.0",
"nesbot/carbon": "^2.0",
@ -1257,14 +1348,13 @@
"filp/whoops": "^2.4",
"guzzlehttp/guzzle": "^6.3",
"league/flysystem-cached-adapter": "^1.0",
"mockery/mockery": "^1.2.3",
"mockery/mockery": "^1.3.1",
"moontoast/math": "^1.1",
"orchestra/testbench-core": "^4.0",
"pda/pheanstalk": "^4.0",
"phpunit/phpunit": "^8.3",
"phpunit/phpunit": "^8.4|^9.0",
"predis/predis": "^1.1.1",
"symfony/cache": "^4.3",
"true/punycode": "^2.1"
"symfony/cache": "^4.3.4"
},
"suggest": {
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).",
@ -1282,6 +1372,7 @@
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
"league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",
"moontoast/math": "Required to use ordered UUIDs (^1.1).",
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).",
@ -1320,20 +1411,20 @@
"framework",
"laravel"
],
"time": "2019-12-19T18:16:22+00:00"
"time": "2020-01-08T21:17:42+00:00"
},
{
"name": "laravel/passport",
"version": "v8.1.0",
"version": "v8.2.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/passport.git",
"reference": "e45ac135c94f72ff77dbc61de97762b35cb76048"
"reference": "4c163b7821d29b6166fc2e93ad7649428b51c6db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/passport/zipball/e45ac135c94f72ff77dbc61de97762b35cb76048",
"reference": "e45ac135c94f72ff77dbc61de97762b35cb76048",
"url": "https://api.github.com/repos/laravel/passport/zipball/4c163b7821d29b6166fc2e93ad7649428b51c6db",
"reference": "4c163b7821d29b6166fc2e93ad7649428b51c6db",
"shasum": ""
},
"require": {
@ -1349,14 +1440,15 @@
"illuminate/encryption": "^6.0|^7.0",
"illuminate/http": "^6.0|^7.0",
"illuminate/support": "^6.0|^7.0",
"laminas/laminas-diactoros": "^2.2",
"league/oauth2-server": "^8.0",
"php": "^7.2",
"phpseclib/phpseclib": "^2.0",
"symfony/psr-http-message-bridge": "^1.0",
"zendframework/zend-diactoros": "^2.0"
"symfony/psr-http-message-bridge": "^1.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "^4.4|^5.0",
"phpunit/phpunit": "^8.0"
},
"type": "library",
@ -1391,7 +1483,7 @@
"oauth",
"passport"
],
"time": "2019-12-30T22:20:25+00:00"
"time": "2020-01-07T19:25:00+00:00"
},
{
"name": "laravel/tinker",
@ -1511,6 +1603,142 @@
],
"time": "2019-05-24T18:30:49+00:00"
},
{
"name": "league/commonmark",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "2533c389fd2a7573d4f7be279b1c33cf941c8dfc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2533c389fd2a7573d4f7be279b1c33cf941c8dfc",
"reference": "2533c389fd2a7573d4f7be279b1c33cf941c8dfc",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1"
},
"replace": {
"colinodell/commonmark-php": "*"
},
"require-dev": {
"cebe/markdown": "~1.0",
"commonmark/commonmark.js": "0.29.1",
"erusev/parsedown": "~1.0",
"ext-json": "*",
"michelf/php-markdown": "~1.4",
"mikehaertl/php-shellcommand": "^1.4",
"phpstan/phpstan-shim": "^0.11.5",
"phpunit/phpunit": "^7.5",
"scrutinizer/ocular": "^1.5",
"symfony/finder": "^4.2"
},
"suggest": {
"league/commonmark-extras": "Library of useful extensions including smart punctuation"
},
"bin": [
"bin/commonmark"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"League\\CommonMark\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com",
"role": "Lead Developer"
}
],
"description": "PHP Markdown parser based on the CommonMark spec",
"homepage": "https://commonmark.thephpleague.com",
"keywords": [
"commonmark",
"markdown",
"parser"
],
"time": "2020-01-09T22:41:09+00:00"
},
{
"name": "league/commonmark-ext-table",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark-ext-table.git",
"reference": "3228888ea69636e855efcf6636ff8e6316933fe7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark-ext-table/zipball/3228888ea69636e855efcf6636ff8e6316933fe7",
"reference": "3228888ea69636e855efcf6636ff8e6316933fe7",
"shasum": ""
},
"require": {
"league/commonmark": "~0.19.3|^1.0",
"php": "^7.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"phpstan/phpstan": "~0.11",
"phpunit/phpunit": "^7.0|^8.0",
"symfony/var-dumper": "^4.0",
"vimeo/psalm": "^3.0"
},
"type": "commonmark-extension",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"psr-4": {
"League\\CommonMark\\Ext\\Table\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Martin Hasoň",
"email": "martin.hason@gmail.com"
},
{
"name": "Webuni s.r.o.",
"homepage": "https://www.webuni.cz"
},
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com"
}
],
"description": "Table extension for league/commonmark",
"homepage": "https://github.com/thephpleague/commonmark-ext-table",
"keywords": [
"commonmark",
"extension",
"markdown",
"table"
],
"time": "2019-09-26T13:28:33+00:00"
},
{
"name": "league/event",
"version": "2.2.0",
@ -4781,74 +5009,6 @@
"environment"
],
"time": "2019-09-10T21:37:39+00:00"
},
{
"name": "zendframework/zend-diactoros",
"version": "2.2.1",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "de5847b068362a88684a55b0dbb40d85986cfa52"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/de5847b068362a88684a55b0dbb40d85986cfa52",
"reference": "de5847b068362a88684a55b0dbb40d85986cfa52",
"shasum": ""
},
"require": {
"php": "^7.1",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"ext-curl": "*",
"ext-dom": "*",
"ext-libxml": "*",
"http-interop/http-factory-tests": "^0.5.0",
"php-http/psr7-integration-tests": "dev-master",
"phpunit/phpunit": "^7.0.2",
"zendframework/zend-coding-standard": "~1.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev",
"dev-develop": "2.2.x-dev",
"dev-release-1.8": "1.8.x-dev"
}
},
"autoload": {
"files": [
"src/functions/create_uploaded_file.php",
"src/functions/marshal_headers_from_sapi.php",
"src/functions/marshal_method_from_sapi.php",
"src/functions/marshal_protocol_version_from_sapi.php",
"src/functions/marshal_uri_from_sapi.php",
"src/functions/normalize_server.php",
"src/functions/normalize_uploaded_files.php",
"src/functions/parse_cookie_header.php"
],
"psr-4": {
"Zend\\Diactoros\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "PSR HTTP Message implementations",
"keywords": [
"http",
"psr",
"psr-7"
],
"abandoned": "laminas/laminas-diactoros",
"time": "2019-11-13T19:16:13+00:00"
}
],
"packages-dev": [
@ -6358,16 +6518,16 @@
},
{
"name": "phpunit/phpunit",
"version": "8.5.1",
"version": "8.5.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "7870c78da3c5e4883eaef36ae47853ebb3cb86f2"
"reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7870c78da3c5e4883eaef36ae47853ebb3cb86f2",
"reference": "7870c78da3c5e4883eaef36ae47853ebb3cb86f2",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/018b6ac3c8ab20916db85fa91bf6465acb64d1e0",
"reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0",
"shasum": ""
},
"require": {
@ -6437,7 +6597,7 @@
"testing",
"xunit"
],
"time": "2019-12-25T14:49:39+00:00"
"time": "2020-01-08T08:49:49+00:00"
},
{
"name": "scrivo/highlight.php",

View file

@ -343,8 +343,8 @@
Generate new alias
</h2>
<p class="mt-4 text-grey-700">
Other aliases e.g. alias@{{ subdomain }} are created automatically when they receive their
first email.
Other aliases e.g. alias@{{ subdomain }} can also be created automatically when they
receive their first email.
</p>
<label for="alias_domain" class="block text-grey-700 text-sm my-2">
Alias Domain:
@ -356,9 +356,12 @@
class="block appearance-none w-full text-grey-700 bg-grey-100 p-3 pr-8 rounded shadow focus:shadow-outline"
required
>
<option v-for="domainOption in allDomains" :key="domainOption" :value="domainOption">{{
domainOption
}}</option>
<option
v-for="domainOption in domainOptions"
:key="domainOption"
:value="domainOption"
>{{ domainOption }}</option
>
</select>
<div
class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
@ -386,9 +389,7 @@
required
>
<option :value="true">UUID</option>
<option :value="false" :disabled="subscription === 'free'"
>Random Words {{ subscription === 'free' ? '(Subscribe To Unlock)' : '' }}</option
>
<option :value="false">Random Words</option>
</select>
<div
class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
@ -570,7 +571,7 @@ export default {
type: String,
required: true,
},
allDomains: {
domainOptions: {
type: Array,
required: true,
},

View file

@ -4,6 +4,6 @@
<div class="container py-8">
@include('shared.status')
<aliases :default-recipient="{{json_encode($defaultRecipient)}}" :initial-aliases="{{json_encode($aliases)}}" :recipient-options="{{json_encode($recipients)}}" :total-forwarded="{{$totalForwarded}}" :total-blocked="{{$totalBlocked}}" :total-replies="{{$totalReplies}}" domain="{{config('anonaddy.domain')}}" subdomain="{{$domain}}" :bandwidth-mb="{{$bandwidthMb}}" :month="{{json_encode(now()->format('M'))}}" :all-domains="{{json_encode(config('anonaddy.all_domains'))}}" />
<aliases :default-recipient="{{json_encode($defaultRecipient)}}" :initial-aliases="{{json_encode($aliases)}}" :recipient-options="{{json_encode($recipients)}}" :total-forwarded="{{$totalForwarded}}" :total-blocked="{{$totalBlocked}}" :total-replies="{{$totalReplies}}" domain="{{config('anonaddy.domain')}}" subdomain="{{$domain}}" :bandwidth-mb="{{$bandwidthMb}}" :month="{{json_encode(now()->format('M'))}}" :domain-options="{{$domainOptions}}" />
</div>
@endsection

View file

@ -343,6 +343,60 @@ class ReceiveEmailTest extends TestCase
});
}
/** @test */
public function it_can_forward_email_with_random_word_generated_alias()
{
Mail::fake();
Mail::assertNothingSent();
$localPart = 'circus.waltz449';
config([
'anonaddy.admin_username' => 'random'
]);
factory(Alias::class)->create([
'user_id' => $this->user->id,
'email' => $localPart.'@anonaddy.me',
'local_part' => $localPart,
'domain' => 'anonaddy.me',
]);
$defaultRecipient = $this->user->defaultRecipient;
$this->artisan(
'anonaddy:receive-email',
[
'file' => base_path('tests/emails/email_with_random_words.eml'),
'--sender' => 'will@anonaddy.com',
'--recipient' => [$localPart.'@anonaddy.me'],
'--local_part' => [$localPart],
'--extension' => [''],
'--domain' => ['anonaddy.me'],
'--size' => '892'
]
)->assertExitCode(0);
$this->assertDatabaseHas('aliases', [
'local_part' => $localPart,
'domain' => 'anonaddy.me',
'email' => $localPart.'@anonaddy.me',
'emails_forwarded' => 1,
'emails_blocked' => 0
]);
$this->assertDatabaseHas('users', [
'id' => $this->user->id,
'username' => 'johndoe',
'bandwidth' => '892'
]);
$this->assertCount(1, $this->user->aliases);
Mail::assertQueued(ForwardEmail::class, function ($mail) use ($defaultRecipient) {
return $mail->hasTo($defaultRecipient->email);
});
}
/** @test */
public function it_can_forward_email_with_existing_alias_and_receipients()
{

View file

@ -0,0 +1,28 @@
Date: Wed, 20 Feb 2019 15:00:00 +0100 (CET)
From: Will <will@anonaddy.com>
To: <circus.waltz449@anonaddy.me>
Subject: Test Email
Content-Type: multipart/mixed; boundary="----=_Part_10031_1199410393.1550677940425"
------=_Part_10031_1199410393.1550677940425
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi,<br>
<br>
This is a test email.<br>
<br>
Will
------=_Part_10031_1199410393.1550677940425
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi,
This is a test email.
Will
------=_Part_10031_1199410393.1550677940425--