transparent-email/README.md

71 lines
2.8 KiB
Markdown
Raw Normal View History

2016-09-10 15:29:03 +02:00
[![Build Status](https://travis-ci.org/bkrukowski/transparent-email.svg?branch=master)](https://travis-ci.org/bkrukowski/transparent-email)
[![Coverage Status](https://coveralls.io/repos/github/bkrukowski/transparent-email/badge.svg?branch=master)](https://coveralls.io/github/bkrukowski/transparent-email?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7f5196c71a7349a4b04228bbafb72c13)](https://www.codacy.com/app/bartlomiej-krukowski/transparent-email?utm_source=github.com&utm_medium=referral&utm_content=bkrukowski/transparent-email&utm_campaign=Badge_Grade)
2016-09-10 02:10:17 +02:00
2016-09-10 15:13:55 +02:00
# Transparent Email
2016-09-10 02:10:17 +02:00
2016-09-10 15:13:55 +02:00
Transparent Email clears aliases from email address. Email `John.Doe+alias@gmail.com` will be transformed to `johndoe@gmail.com`.
2016-09-10 02:10:17 +02:00
2016-09-10 14:10:52 +02:00
## Why?
2016-09-10 14:11:19 +02:00
To detect multi-accounts on your website.
2016-09-10 14:10:52 +02:00
2016-09-10 02:10:17 +02:00
## Supported mailboxes
2016-09-16 01:20:39 +02:00
* [gmail.com](https://gmail.com) and [Google Apps](https://apps.google.com) with custom domain
2016-09-10 02:10:17 +02:00
* [tlen.pl](http://tlen.pl)
* [33mail.com](https://www.33mail.com)
2016-09-10 12:15:37 +02:00
* [outlook.com](http://outlook.com)
2016-09-10 13:33:57 +02:00
* [yahoo.com](http://mail.yahoo.com)
2016-09-10 02:10:17 +02:00
## Usage
```php
use bkrukowski\TransparentEmail\TransparentEmailFactory;
2016-09-24 12:54:02 +02:00
use bkrukowski\TransparentEmail\Emails\Email;
2016-10-14 21:15:15 +02:00
use bkrukowski\TransparentEmail\Emails\EmailInterface;
2016-09-24 12:54:02 +02:00
use bkrukowski\TransparentEmail\Emails\InvalidEmailException;
try {
2016-10-26 20:13:11 +02:00
$factory = new TransparentEmailFactory();
$cleaner = $factory->createDefault();
2016-10-14 21:15:15 +02:00
$inputEmail = new Email('John.Doe+alias@gmail.com');
/** @var EmailInterface $transformedEmail */
$transformedEmail = $cleaner->getPrimaryEmail($inputEmail);
echo $transformedEmail;
2016-09-24 12:54:02 +02:00
} catch (InvalidEmailException $exception) {
2016-10-14 21:15:15 +02:00
echo 'Invalid email!';
2016-09-24 12:54:02 +02:00
}
2016-09-10 14:10:52 +02:00
```
2016-10-14 20:38:37 +02:00
## Versioning
The version numbers follow the [Semantic Versioning 2.0.0](http://semver.org/) scheme.
2016-09-10 14:10:52 +02:00
## Yahoo.com
Aliases work different on Yahoo than on Gmail. On Gmail part after plus is skipped.
2016-09-13 18:20:51 +02:00
For example message sent to `janedoe+alias@gmail.com` will be redirected to `janedoe@gmail.com`.
2016-09-10 14:10:52 +02:00
Yahoo uses the following pattern[*](https://help.yahoo.com/kb/SLN16026.html):
*baseName*-*keyword*@yahoo.com
* *baseName* - value defined by the user, different than email login;
* *keyword* - one from a list of keywords defined by the user.
2016-09-10 14:45:30 +02:00
Therefore we do not know what is the real email, so in this case result will be `baseName@yahoo.com`,
2020-02-19 12:09:32 +03:00
which actually does not exist.
## Yandex.ru
In official [documentation](https://yandex.com/support/mail/web/preferences/about-sender/additional-addresses.html) you can find some use-cases about aliases usage.
## Mail.ru
Mail.ru service uses following aliases:
* `janedoe+alias@mail.ru` will be redirected to `janedoe@mail.ru`
* `janeDoe@MAIL.RU` will be redirected to `janedoe@mail.ru`
## Icloud.com
Icloud.com service uses following aliases:
* `janedoe+alias@icloud.com` will be redirected to `janedoe@icloud.com`
* `janeDoe@ICLOUD.COM` will be redirected to `janedoe@icloud.com`