diff --git a/vagrant_setup.md b/vagrant_setup.md new file mode 100644 index 0000000..e44ba31 --- /dev/null +++ b/vagrant_setup.md @@ -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 + ``` + + diff --git a/validate_email.py b/validate_email.py index 3dc50e9..0f18e3e 100644 --- a/validate_email.py +++ b/validate_email.py @@ -51,7 +51,7 @@ except (ImportError, AttributeError): # even when it's not strictly necessary. This way we don't forget # 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 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 @@ -101,7 +101,7 @@ def get_mx_ip(hostname): try: MX_DNS_CACHE[hostname] = DNS.mxlookup(hostname) 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 else: raise