mirror of
https://github.com/aljazceru/validate_email.git
synced 2025-12-18 14:44:22 +01:00
Merge pull request #40 from efagerberg/master
Make regex check for all whitespace and check for servfail
This commit is contained in:
51
vagrant_setup.md
Normal file
51
vagrant_setup.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
How to Set Up Validate Email Using Vagrant on PC
|
||||||
|
-------------------------------------------------
|
||||||
|
|
||||||
|
1. Download Vagrant & Virtual Box
|
||||||
|
* http://www.vagrantup.com/downloads
|
||||||
|
* http://www.virtualbox.org/
|
||||||
|
2. Look at http://docs.vagrantup.com/v2/getting-started/ to make a linux virtual machine via vagrant
|
||||||
|
* tl;dr using bash (Can use regular Windows Terminal)
|
||||||
|
* Make a folder first, whenever you want to access the vm you will need to cd into that folder
|
||||||
|
```
|
||||||
|
$ vagrant init hashicorp/precise32
|
||||||
|
|
||||||
|
$ vagrant up
|
||||||
|
|
||||||
|
$ vagrant ssh
|
||||||
|
```
|
||||||
|
* This last command is used to go into your vm
|
||||||
|
3. Install pipin the vm
|
||||||
|
* http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/
|
||||||
|
* tl;dr
|
||||||
|
```
|
||||||
|
$ sudo apt-get install python-pip
|
||||||
|
|
||||||
|
```
|
||||||
|
4. Install pyDNS
|
||||||
|
```
|
||||||
|
This is a package dependency of validate email
|
||||||
|
|
||||||
|
$ sudo pip install pydns
|
||||||
|
```
|
||||||
|
5. Install git
|
||||||
|
```
|
||||||
|
$ sudo apt-get install git
|
||||||
|
```
|
||||||
|
6. Clone the validate_email repo to your vm
|
||||||
|
* (Since its a new machine you will need to clone using the https url)
|
||||||
|
* ```$ git clone git@github.com:efagerberg/validate_email.git```
|
||||||
|
* If you want to use your ssh keys on your machine you will need to add this line to the vagrant file under the config
|
||||||
|
* Looks somthing like this:
|
||||||
|
Vagrant::Config.run do |config|
|
||||||
|
# stuff
|
||||||
|
config.ssh.forward_agent = true
|
||||||
|
end
|
||||||
|
7. cd into validate_email and run script
|
||||||
|
```
|
||||||
|
$ cd validate_email
|
||||||
|
|
||||||
|
$ python validate_email.py
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ except (ImportError, AttributeError):
|
|||||||
# even when it's not strictly necessary. This way we don't forget
|
# even when it's not strictly necessary. This way we don't forget
|
||||||
# when it is necessary.)
|
# when it is necessary.)
|
||||||
#
|
#
|
||||||
WSP = r'[ \t]' # see 2.2.2. Structured Header Field Bodies
|
WSP = r'[\s]' # see 2.2.2. Structured Header Field Bodies
|
||||||
CRLF = r'(?:\r\n)' # see 2.2.3. Long Header Fields
|
CRLF = r'(?:\r\n)' # see 2.2.3. Long Header Fields
|
||||||
NO_WS_CTL = r'\x01-\x08\x0b\x0c\x0f-\x1f\x7f' # see 3.2.1. Primitive Tokens
|
NO_WS_CTL = r'\x01-\x08\x0b\x0c\x0f-\x1f\x7f' # see 3.2.1. Primitive Tokens
|
||||||
QUOTED_PAIR = r'(?:\\.)' # see 3.2.2. Quoted characters
|
QUOTED_PAIR = r'(?:\\.)' # see 3.2.2. Quoted characters
|
||||||
@@ -101,7 +101,7 @@ def get_mx_ip(hostname):
|
|||||||
try:
|
try:
|
||||||
MX_DNS_CACHE[hostname] = DNS.mxlookup(hostname)
|
MX_DNS_CACHE[hostname] = DNS.mxlookup(hostname)
|
||||||
except ServerError as e:
|
except ServerError as e:
|
||||||
if e.rcode == 3: # NXDOMAIN (Non-Existent Domain)
|
if e.rcode == 3 or e.rcode == 2: # NXDOMAIN (Non-Existent Domain) or SERVFAIL
|
||||||
MX_DNS_CACHE[hostname] = None
|
MX_DNS_CACHE[hostname] = None
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user