Subversion Repositories javautils

Compare Revisions

No changes between revisions

Regard whitespace Rev 8 → Rev 9

/ViaThinkSoft Java Utils/test/emailSayersTests.xml
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/ViaThinkSoft Java Utils/test/emailExperimentalTests.xml
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/ViaThinkSoft Java Utils/test/de/viathinksoft/utils/mail/sender/TestConfiguration.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/ViaThinkSoft Java Utils/test/de/viathinksoft/utils/mail/sender/RawMailSenderPlainTextTest.java
11,13 → 11,13
import org.junit.Test;
 
import de.viathinksoft.utils.mail.EMailAddress;
import de.viathinksoft.utils.mail.InvalidMailAddressException;
import de.viathinksoft.utils.mail.sender.PlainTextMailSender;
import eMailTests.TestConfiguration;
 
public class RawMailSenderPlainTextTest {
@Test
public void testPostMailNullPointer() throws MessagingException,
AuthentificateDataIncompleteException, InvalidMailAddressException {
AuthentificateDataIncompleteException {
PlainTextMailSender mailsender = new PlainTextMailSender();
 
try {
42,7 → 42,7
try {
mailsender.setRecipient((EMailAddress)null);
fail();
} catch (InvalidMailAddressException e1) {
} catch (NullPointerException e1) {
}
 
try {
67,7 → 67,7
try {
mailsender.setRecipient((String)null);
fail();
} catch (InvalidMailAddressException e1) {
} catch (NullPointerException e1) {
}
 
try {
136,7 → 136,7
try {
mailsender.setMailFrom((EMailAddress)null);
fail();
} catch (InvalidMailAddressException e1) {
} catch (NullPointerException e1) {
}
mailsender.setSubject(null);
mailsender.setMessage(null);
153,7 → 153,7
try {
mailsender.setMailFrom((String)null);
fail();
} catch (InvalidMailAddressException e1) {
} catch (NullPointerException e1) {
}
 
try {
174,7 → 174,7
 
@Test
public void testPostMailBlank()
throws AuthentificateDataIncompleteException, InvalidMailAddressException {
throws AuthentificateDataIncompleteException {
PlainTextMailSender mailsender = new PlainTextMailSender();
 
mailsender.setRecipient(TestConfiguration.getSpamAddress());
200,7 → 200,7
 
@Test
public void testPostMailWithData() throws MessagingException,
AuthentificateDataIncompleteException, InvalidMailAddressException
AuthentificateDataIncompleteException
{
PlainTextMailSender mailsender = new PlainTextMailSender();
 
221,7 → 221,7
 
@Test
public void testPostMailWithDataAndOrigin() throws MessagingException,
AuthentificateDataIncompleteException, InvalidMailAddressException {
AuthentificateDataIncompleteException {
PlainTextMailSender mailsender = new PlainTextMailSender();
 
mailsender.setSmtpHost(TestConfiguration.getSmtpHost());
243,7 → 243,7
 
@Test
public void testPostMailWithDataAndOriginAndSmtpAuthIncompleteUserAndPwd()
throws MessagingException, InvalidMailAddressException {
throws MessagingException {
PlainTextMailSender mailsender = new PlainTextMailSender();
 
mailsender.setSmtpHost(TestConfiguration.getSmtpHost());
269,7 → 269,7
 
@Test
public void testPostMailWithDataAndOriginAndSmtpAuthIncompleteUser()
throws MessagingException, InvalidMailAddressException {
throws MessagingException {
PlainTextMailSender mailsender = new PlainTextMailSender();
 
mailsender.setSmtpHost(TestConfiguration.getSmtpHost());
295,7 → 295,7
 
@Test
public void testPostMailWithDataAndOriginAndSmtpAuthIncompletePwd()
throws MessagingException, InvalidMailAddressException {
throws MessagingException {
PlainTextMailSender mailsender = new PlainTextMailSender();
 
mailsender.setSmtpHost(TestConfiguration.getSmtpHost());
321,7 → 321,7
 
@Test
public void testPostMailWithDataAndOriginAndSmtpAuthComplete()
throws MessagingException, AuthentificateDataIncompleteException, InvalidMailAddressException {
throws MessagingException, AuthentificateDataIncompleteException {
PlainTextMailSender mailsender = new PlainTextMailSender();
 
mailsender.setSmtpHost(TestConfiguration.getSmtpHost());
/ViaThinkSoft Java Utils/test/de/viathinksoft/utils/mail/syntaxchecker/MailSyntaxCheckerTest.java
0,0 → 1,113
package de.viathinksoft.utils.mail.syntaxchecker;
 
import static org.junit.Assert.*;
 
import java.io.File;
import java.io.IOException;
 
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
 
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
 
import de.viathinksoft.utils.mail.EMailAddress;
 
public class MailSyntaxCheckerTest {
static int errorCount;
private void checkXML(String xmlFile) throws ParserConfigurationException, SAXException, IOException {
File file = new File(xmlFile);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
doc.getDocumentElement().normalize();
NodeList nodeLst = doc.getElementsByTagName("test");
for (int s = 0; s < nodeLst.getLength(); s++) {
 
Node fstNode = nodeLst.item(s);
 
if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
 
Element fstElmnt = (Element) fstNode;
 
String id;
String address;
boolean expected;
 
NodeList fstNmElmntLst;
Element fstNmElmnt;
NodeList fstNm;
String cont;
 
fstNmElmntLst = fstElmnt.getElementsByTagName("address");
fstNmElmnt = (Element) fstNmElmntLst.item(0);
fstNm = fstNmElmnt.getChildNodes();
try {
cont = ((Node) fstNm.item(0)).getNodeValue();
} catch (NullPointerException e) {
cont = "";
}
address = cont;
 
fstNmElmntLst = fstElmnt.getElementsByTagName("valid");
fstNmElmnt = (Element) fstNmElmntLst.item(0);
fstNm = fstNmElmnt.getChildNodes();
cont = ((Node) fstNm.item(0)).getNodeValue();
expected = Boolean.parseBoolean(cont);
 
fstNmElmntLst = fstElmnt.getElementsByTagName("id");
fstNmElmnt = (Element) fstNmElmntLst.item(0);
fstNm = fstNmElmnt.getChildNodes();
cont = ((Node) fstNm.item(0)).getNodeValue();
id = cont;
 
boolean actual = MailSyntaxChecker.isMailValid(address);
 
// assertEquals(expected, actual);
if (expected != actual) {
System.err.println("Mail Test #" + id + " FAILED! '"
+ address + "' is '" + actual + "' instead of '"
+ expected + "'!");
errorCount++;
}
}
}
}
 
@Test
public void performXMLTests() throws SAXException, IOException,
ParserConfigurationException {
 
// First: Null-Pointer Test
try {
MailSyntaxChecker.isMailValid((String)null);
fail();
} catch (NullPointerException e) {
}
 
try {
MailSyntaxChecker.isMailValid((EMailAddress)null);
fail();
} catch (NullPointerException e) {
}
// Now check the XML testcases
checkXML("test/eMailTests/SayersTests.xml");
checkXML("test/eMailTests/emailExperimentalTests.xml");
 
if (errorCount > 0) {
System.err.println("==> " + errorCount + " ERRORS OCCOURED! <==");
fail();
}
}
}
/ViaThinkSoft Java Utils/test/de/viathinksoft/utils/mail/EMailAddressTest.java
12,95 → 12,108
private static final String ExampleUnicode = IDN.toUnicode(ExamplePunycode);
@Test
public void testAddressParsing() throws InvalidMailAddressException {
public void testAddressParsing() {
try {
new EMailAddress(null);
fail();
} catch (InvalidMailAddressException e) {
} catch (NullPointerException e) {
}
try {
new EMailAddress("");
fail();
} catch (InvalidMailAddressException e) {
}
EMailAddress a;
try {
new EMailAddress("bla");
fail();
} catch (InvalidMailAddressException e) {
}
a = new EMailAddress("");
assertEquals("", a.getLocalPart());
// assertEquals("", a.getLocalPartASCII());
assertEquals("", a.getDomainPartUnicode());
assertEquals("", a.getDomainPartPunycode());
assertEquals("", a.getTldUnicode());
assertEquals("", a.getTldPunycode());
assertEquals("", a.toString());
assertEquals("", a.getMailAddressUnicode());
assertEquals("", a.getMailAddressPunycodedDomain());
EMailAddress a;
a = new EMailAddress("bla");
assertEquals("bla", a.getLocalPart());
// assertEquals("", a.getLocalPartASCII());
assertEquals("", a.getDomainPartUnicode());
assertEquals("", a.getDomainPartPunycode());
assertEquals("", a.getTldUnicode());
assertEquals("", a.getTldPunycode());
assertEquals("bla", a.toString());
assertEquals("bla", a.getMailAddressUnicode());
assertEquals("bla", a.getMailAddressPunycodedDomain());
// a = new EMailAddress("@");
// assertEquals(a.getLocalPartUnicode(), "");
// // assertEquals(a.getLocalPartASCII(), "");
// assertEquals(a.getDomainPartUnicode(), "");
// assertEquals(a.getDomainPartASCII(), "");
// assertEquals(a.getTldUnicode(), "");
// assertEquals(a.getTldASCII(), "");
// assertEquals(a.getTldUnicode(), "");
// assertEquals(a.getMailAddressASCII(), "");
a = new EMailAddress(ExampleUnicode);
assertEquals(ExampleUnicode, a.getLocalPart());
// assertEquals("", a.getLocalPartASCII());
assertEquals("", a.getDomainPartUnicode());
assertEquals("", a.getDomainPartPunycode());
assertEquals("", a.getTldUnicode());
assertEquals("", a.getTldPunycode());
assertEquals(ExampleUnicode, a.toString());
assertEquals(ExampleUnicode, a.getMailAddressUnicode());
assertEquals(ExampleUnicode, a.getMailAddressPunycodedDomain());
try {
new EMailAddress("@");
// Es wird InvalidMailAddressException anstelle von
// local="" und domain="" ausgegeben,
// weil .split nicht so wie .explode reagiert
fail();
} catch (InvalidMailAddressException e) {
}
a = new EMailAddress("@");
assertEquals("", a.getLocalPart());
// assertEquals("", a.getLocalPartASCII());
assertEquals("", a.getDomainPartUnicode());
assertEquals("", a.getDomainPartPunycode());
assertEquals("", a.getTldUnicode());
assertEquals("", a.getTldPunycode());
assertEquals("", a.toString());
assertEquals("", a.getMailAddressUnicode());
assertEquals("", a.getMailAddressPunycodedDomain());
 
a = new EMailAddress("local@domain");
assertEquals(a.getLocalPart(), "local");
// assertEquals(a.getLocalPartASCII(), "local");
assertEquals(a.getDomainPartUnicode(), "domain");
assertEquals(a.getDomainPartPunycode(), "domain");
assertEquals(a.getTldUnicode(), "");
assertEquals(a.getTldPunycode(), "");
assertEquals(a.toString(), "local@domain");
assertEquals(a.getMailAddressUnicode(), "local@domain");
assertEquals(a.getMailAddressPunycodedDomain(), "local@domain");
assertEquals("local", a.getLocalPart());
// assertEquals("local", a.getLocalPartASCII());
assertEquals("domain", a.getDomainPartUnicode());
assertEquals("domain", a.getDomainPartPunycode());
assertEquals("", a.getTldUnicode());
assertEquals("", a.getTldPunycode());
assertEquals("local@domain", a.toString());
assertEquals("local@domain", a.getMailAddressUnicode());
assertEquals("local@domain", a.getMailAddressPunycodedDomain());
 
a = new EMailAddress("local@domain.tld");
assertEquals(a.getLocalPart(), "local");
// assertEquals(a.getlocalPartASCII(), "local");
assertEquals(a.getDomainPartUnicode(), "domain.tld");
assertEquals(a.getDomainPartPunycode(), "domain.tld");
assertEquals(a.getTldUnicode(), "tld");
assertEquals(a.getTldPunycode(), "tld");
assertEquals(a.toString(), "local@domain.tld");
assertEquals(a.getMailAddressUnicode(), "local@domain.tld");
assertEquals(a.getMailAddressPunycodedDomain(), "local@domain.tld");
assertEquals("local", a.getLocalPart());
// assertEquals("local", a.getlocalPartASCII());
assertEquals("domain.tld", a.getDomainPartUnicode());
assertEquals("domain.tld", a.getDomainPartPunycode());
assertEquals("tld", a.getTldUnicode());
assertEquals("tld", a.getTldPunycode());
assertEquals("local@domain.tld", a.toString());
assertEquals("local@domain.tld", a.getMailAddressUnicode());
assertEquals("local@domain.tld", a.getMailAddressPunycodedDomain());
a = new EMailAddress("local@"+ExampleUnicode+".jp");
assertEquals(a.getLocalPart(), "local");
// assertEquals(a.getlocalPartASCII(), "local");
assertEquals(a.getDomainPartUnicode(), ExampleUnicode+".jp");
assertEquals(a.getDomainPartPunycode(), ExamplePunycode+".jp");
assertEquals(a.getTldUnicode(), "jp");
assertEquals(a.getTldPunycode(), "jp");
assertEquals(a.getMailAddressUnicode(), "local@"+ExampleUnicode+".jp");
assertEquals(a.getMailAddressPunycodedDomain(), "local@"+ExamplePunycode+".jp");
assertEquals("local", a.getLocalPart());
// assertEquals("local", a.getlocalPartASCII());
assertEquals(ExampleUnicode+".jp", a.getDomainPartUnicode());
assertEquals(ExamplePunycode+".jp", a.getDomainPartPunycode());
assertEquals("jp", a.getTldUnicode());
assertEquals("jp", a.getTldPunycode());
assertEquals("local@"+ExampleUnicode+".jp", a.getMailAddressUnicode());
assertEquals("local@"+ExamplePunycode+".jp", a.getMailAddressPunycodedDomain());
EMailAddress.USE_UNICODE_AS_STANDARD = true;
assertEquals(a.toString(), "local@"+ExampleUnicode+".jp");
assertEquals("local@"+ExampleUnicode+".jp", a.toString());
EMailAddress.USE_UNICODE_AS_STANDARD = false;
assertEquals(a.toString(), "local@"+ExamplePunycode+".jp");
assertEquals("local@"+ExamplePunycode+".jp", a.toString());
 
a = new EMailAddress("local@example."+ExampleUnicode);
assertEquals(a.getLocalPart(), "local");
// assertEquals(a.getlocalPartASCII(), "local");
assertEquals(a.getDomainPartUnicode(), "example."+ExampleUnicode);
assertEquals(a.getDomainPartPunycode(), "example."+ExamplePunycode);
assertEquals(a.getTldUnicode(), ExampleUnicode);
assertEquals(a.getTldPunycode(), ExamplePunycode);
assertEquals(a.getMailAddressUnicode(), "local@example."+ExampleUnicode);
assertEquals(a.getMailAddressPunycodedDomain(), "local@example."+ExamplePunycode);
assertEquals("local", a.getLocalPart());
// assertEquals("local", a.getlocalPartASCII());
assertEquals("example."+ExampleUnicode, a.getDomainPartUnicode());
assertEquals("example."+ExamplePunycode, a.getDomainPartPunycode());
assertEquals(ExampleUnicode, a.getTldUnicode());
assertEquals(ExamplePunycode, a.getTldPunycode());
assertEquals("local@example."+ExampleUnicode, a.getMailAddressUnicode());
assertEquals("local@example."+ExamplePunycode, a.getMailAddressPunycodedDomain());
EMailAddress.USE_UNICODE_AS_STANDARD = true;
assertEquals(a.toString(), "local@example."+ExampleUnicode);
assertEquals("local@example."+ExampleUnicode, a.toString());
EMailAddress.USE_UNICODE_AS_STANDARD = false;
assertEquals(a.toString(), "local@example."+ExamplePunycode);
assertEquals("local@example."+ExamplePunycode, a.toString());
}
@Test
120,7 → 133,7
}
@Test
public void testClone() throws InvalidMailAddressException, CloneNotSupportedException {
public void testClone() throws CloneNotSupportedException {
EMailAddress a = new EMailAddress("local@example."+ExampleUnicode);
EMailAddress b = (EMailAddress) a.clone();
128,21 → 141,21
assertTrue(a.equals(b));
assertTrue(b.equals(a));
assertEquals(a.getDomainPartPunycode(), b.getDomainPartPunycode());
assertEquals(a.getDomainPartUnicode(), b.getDomainPartUnicode());
assertEquals(a.getLocalPart(), b.getLocalPart());
assertEquals(a.getMailAddressPunycodedDomain(), b.getMailAddressPunycodedDomain());
assertEquals(a.getMailAddressUnicode(), b.getMailAddressUnicode());
assertEquals(a.getTldPunycode(), b.getTldPunycode());
assertEquals(a.getTldUnicode(), b.getTldUnicode());
assertEquals(b.getDomainPartPunycode(), a.getDomainPartPunycode());
assertEquals(b.getDomainPartUnicode(), a.getDomainPartUnicode());
assertEquals(b.getLocalPart(), a.getLocalPart());
assertEquals(b.getMailAddressPunycodedDomain(), a.getMailAddressPunycodedDomain());
assertEquals(b.getMailAddressUnicode(), a.getMailAddressUnicode());
assertEquals(b.getTldPunycode(), a.getTldPunycode());
assertEquals(b.getTldUnicode(), a.getTldUnicode());
EMailAddress.USE_UNICODE_AS_STANDARD = true;
assertEquals(a.toString(), b.toString());
assertEquals(b.toString(), a.toString());
EMailAddress.USE_UNICODE_AS_STANDARD = false;
assertEquals(a.toString(), b.toString());
assertEquals(b.toString(), a.toString());
}
@Test
public void testEquals() throws InvalidMailAddressException {
public void testEquals() {
EMailAddress a = new EMailAddress("local@example."+ExampleUnicode);
EMailAddress b = new EMailAddress("local@example."+ExampleUnicode);
/ViaThinkSoft Java Utils/test/eMailTests/ExperimentalTests.xml
0,0 → 1,807
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
 
Umlaute sind nicht erlaubt
Anmerkung: Die Übersetzung in den Punnycode muss durch den Clienten
stattfinden
TODO: Sollen diese Adressen trotzdem zugelassen werden?
 
* müller@compuglobal.org" => false
* "test@müller.de" => false
* "müller@müllermilch.de" => false
 
-->
<tests>
<test>
<address>info@compuglobal.org</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9000</id>
</test>
<test>
<address>info@example.eu</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9001</id>
</test>
<test>
<address>info@example.uk</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9002</id>
</test>
<test>
<address>info@example.co.uk</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9003</id>
</test>
<test>
<address>info@example.ltd.uk</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9004</id>
</test>
<test>
<address>info@example.asso.fr</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9005</id>
</test>
<test>
<address>info@example.mil</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9006</id>
</test>
<test>
<address>example@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9007</id>
</test>
<test>
<address>john@server.department.company.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9008</id>
</test>
<test>
<address>test &lt;mail@test.de&gt;</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9009</id>
</test>
<test>
<address>INFO@COMPUGLOBAL.ORG</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9010</id>
</test>
<test>
<address>info@compuglobal.org info@compuglobal.org</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9011</id>
</test>
<test>
<address>info@compuglobal.org, info@compuglobal.org</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9012</id>
</test>
<test>
<address>info@compuglobal.org; info@compuglobal.org</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9013</id>
</test>
<test>
<address>info@compuglobal.org </address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9014</id>
</test>
<test>
<address> info@compuglobal.org </address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9015</id>
</test>
<test>
<address>
&#13;
info@compuglobal.org
 
 
&#13;
</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9016</id>
</test>
<test>
<address>invalid@test@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9017</id>
</test>
<test>
<address>invalidexample.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9018</id>
</test>
<test>
<address>john@aol...com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9019</id>
</test>
<test>
<address>john@aol...aol.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9020</id>
</test>
<test>
<address>test@invalid</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9021</id>
</test>
<test>
<address>invalid</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9022</id>
</test>
<test>
<address/>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9023</id>
</test>
<test>
<address>hallo@127.0.0.1</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9024</id>
</test>
<test>
<address>hallo@[127.0.0.1]</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9025</id>
</test>
<test>
<address>Arabic@مثال.إختبار</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9026</id>
</test>
<test>
<address>Persian@مثال.آزمایشی</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9027</id>
</test>
<test>
<address>ChineseSimplified@例子.测试</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9028</id>
</test>
<test>
<address>ChineseTraditional@例子.測試</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9029</id>
</test>
<test>
<address>Cyrillic@пример.испытание</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9030</id>
</test>
<test>
<address>Hindi@उदाहरण.परीक्षा</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9031</id>
</test>
<test>
<address>Greek@παράδειγμα.δοκιμή</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9032</id>
</test>
<test>
<address>Korean@실례.테스트</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9033</id>
</test>
<test>
<address>YiddishHebrew@בײַשפּיל.טעסט</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9034</id>
</test>
<test>
<address>Japanese@例え.テスト</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9035</id>
</test>
<test>
<address>Tamil@உதாரணம்.பரிட்சை</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9036</id>
</test>
<test>
<address>Arabic@xn--mgbh0fb.xn--kgbechtv</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9037</id>
</test>
<test>
<address>Persian@xn--mgbh0fb.xn--hgbk6aj7f53bba</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9038</id>
</test>
<test>
<address>ChineseSimplified@xn--fsqu00a.xn--0zwm56d</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9039</id>
</test>
<test>
<address>ChineseTraditional@xn--fsqu00a.xn--g6w251d</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9040</id>
</test>
<test>
<address>Cyrillic@xn--e1afmkfd.xn--80akhbyknj4f</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9041</id>
</test>
<test>
<address>Hindi@xn--p1b6ci4b4b3a.xn--11b5bs3a9aj6g</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9042</id>
</test>
<test>
<address>Greek@xn--hxajbheg2az3al.xn--jxalpdlp</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9043</id>
</test>
<test>
<address>Korean@xn--9n2bp8q.xn--9t4b11yi5a</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9044</id>
</test>
<test>
<address>YiddishHebrew@xn--fdbk5d8ap9b8a8d.xn--deba0ad</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9045</id>
</test>
<test>
<address>Japanese@xn--r8jz45g.xn--zckzah</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9046</id>
</test>
<test>
<address>Tamil@xn--zkc6cc5bi7f6e.xn--hlcj6aya9esc7a</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9047</id>
</test>
<test>
<address>root</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9048</id>
</test>
<test>
<address>a@b.c</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9049</id>
</test>
<test>
<address>me@.my.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9050</id>
</test>
<test>
<address>hello world@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9051</id>
</test>
<test>
<address>test.@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9052</id>
</test>
<test>
<address>.test@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9053</id>
</test>
<test>
<address>"Angela Merkel"@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9054</id>
</test>
<test>
<address>Abc.example.com</address>
<valid>false</valid>
<source>http://en.wikipedia.org/wiki/E-mail_address</source>
<comment>haracter @ is missing</comment>
<sourcelink/>
<id>9055</id>
</test>
<test>
<address>Abc.@example.com</address>
<valid>false</valid>
<source/>
<comment>character dot(.) is last in local part</comment>
<sourcelink/>
<id>9056</id>
</test>
<test>
<address>Abc..123@example.com</address>
<valid>false</valid>
<source/>
<comment>character dot(.) is double</comment>
<sourcelink/>
<id>9057</id>
</test>
<test>
<address>A@b@c@example.com</address>
<valid>false</valid>
<source>http://en.wikipedia.org/wiki/E-mail_address</source>
<comment>only one @ is allowed outside quotations marks</comment>
<sourcelink/>
<id>9058</id>
</test>
<test>
<address>()[]\;:,&lt;&gt;@example.com</address>
<valid>false</valid>
<source>http://en.wikipedia.org/wiki/E-mail_address</source>
<comment>none of the characters before the @ in this example are allowed outside quotation marks</comment>
<sourcelink/>
<id>9059</id>
</test>
<test>
<address>test@localhost</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9060</id>
</test>
<test>
<address>john@mail.invalid</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9061</id>
</test>
<test>
<address>john@mail.xx</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink/>
<id>9062</id>
</test>
<test>
<address>foo\@bar@internet.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://stackoverflow.com/questions/2514810/php-email-validation-question/2515111#2515111</sourcelink>
<id>9063</id>
</test>
<test>
<address>test/foo=bar@persona.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://stackoverflow.com/questions/2514810/php-email-validation-question/2515111#2515111</sourcelink>
<id>9064</id>
</test>
<test>
<address>my..name@address.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://stackoverflow.com/questions/2514810/php-email-validation-question/2515111#2515111</sourcelink>
<id>9065</id>
</test>
<test>
<address>.myaddress@address.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://stackoverflow.com/questions/2514810/php-email-validation-question/2515111#2515111</sourcelink>
<id>9066</id>
</test>
<test>
<address>Aa0.!#$%&amp;'*+-/=?^_`{|}~\ \"\@\:\;@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink/>
<id>9067</id>
</test>
<test>
<address>dclo@us.ibm.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9068</id>
</test>
<test>
<address>abc\@def@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9069</id>
</test>
<test>
<address>abc\\@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9070</id>
</test>
<test>
<address>Fred\ Bloggs@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9071</id>
</test>
<test>
<address>Joe.\\Blow@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9072</id>
</test>
<test>
<address>"Abc@def"@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9073</id>
</test>
<test>
<address>"Fred Bloggs"@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9074</id>
</test>
<test>
<address>customer/department=shipping@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9075</id>
</test>
<test>
<address>\$A12345@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9076</id>
</test>
<test>
<address>!def!xyz%abc@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9077</id>
</test>
<test>
<address>_somename@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9078</id>
</test>
<test>
<address>user+mailbox@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9079</id>
</test>
<test>
<address>peter.piper@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9080</id>
</test>
<test>
<address>Doug\ \"Ace\"\ Lovell@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9081</id>
</test>
<test>
<address>"Doug \"Ace\" L."@example.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9082</id>
</test>
<test>
<address>abc@def@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9083</id>
</test>
<test>
<address>abc\\@def@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9084</id>
</test>
<test>
<address>abc\@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9085</id>
</test>
<test>
<address>@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9086</id>
</test>
<test>
<address>doug@</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9087</id>
</test>
<test>
<address>"qu@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9088</id>
</test>
<test>
<address>ote"@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9089</id>
</test>
<test>
<address>.dot@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9090</id>
</test>
<test>
<address>dot.@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9091</id>
</test>
<test>
<address>two..dot@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9092</id>
</test>
<test>
<address>"Doug "Ace" L."@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9093</id>
</test>
<test>
<address>Doug\ \"Ace\"\ L\.@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9094</id>
</test>
<test>
<address>hello world@example.com</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9095</id>
</test>
<test>
<address>gatsby@f.sc.ot.t.f.i.tzg.era.l.d.</address>
<valid>false</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9096</id>
</test>
<test>
<address>{^c\@**Dog^}@cartoon.com</address>
<valid>true</valid>
<source/>
<comment/>
<sourcelink>http://www.linuxjournal.com/article/9585?page=0,2</sourcelink>
<id>9097</id>
</test>
</tests>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/ViaThinkSoft Java Utils/test/eMailTests/TestConfiguration.java
0,0 → 1,37
package eMailTests;
 
// Statische Klasse, die unsere Konfiguration für Tests verwaltet.
// Ginge auch als Singleton
 
public final class TestConfiguration {
public static String getSpamAddress() {
// Gott habe Mitleid mit dem Eigentümer dieser E-Mail-Adresse...
return "b973768@owlpic.com";
 
// Eine Wegwerfadresse für manuelle Tests kann auf
// www.10minutemail.com erstellt werden.
}
public static String getSmtpHost() {
return "";
}
public static String getSmtpUsername() {
return "";
}
public static String getSmtpPassword() {
return "";
}
public static int getSmtpPort() {
return 25;
}
public static String getMailFrom() {
return getSpamAddress();
}
private TestConfiguration() {
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/ViaThinkSoft Java Utils/test/eMailTests/SayersTests.xml
0,0 → 1,1746
<?xml version="1.0" encoding="utf-8"?>
 
<!--
Source: http://isemail.googlecode.com/svn/trunk/tests/tests.xml
-->
 
<tests version="1.10">
<test>
<address>first.last@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>1</id>
</test>
<test>
<address>1234567890123456789012345678901234567890123456789012345678901234@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>2</id>
</test>
<test>
<address>first.last@sub.do,com</address>
<valid>false</valid>
<comment>Mistyped comma instead of dot (replaces old #3 which was the same as #57)</comment>
<source>Rob &lt;bob@bob.com&gt;</source>
<id>3</id>
</test>
<test>
<address>"first\"last"@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>4</id>
</test>
<test>
<address>first\@last@example.com</address>
<valid>false</valid>
<comment>Escaping can only happen within a quoted string</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>5</id>
</test>
<test>
<address>"first@last"@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>6</id>
</test>
<test>
<address>"first\\last"@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>7</id>
</test>
<test>
<address>x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x2</address>
<valid>true</valid>
<comment>Total length reduced to 254 characters so it's still valid</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>8</id>
</test>
<test>
<address>1234567890123456789012345678901234567890123456789012345678@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.123456789012345678901234567890123456789012345678901234567890123.example.com</address>
<valid>true</valid>
<comment>Total length reduced to 254 characters so it's still valid</comment>
<source>RFC 3696 erratum 1690</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=1690</sourcelink>
<id>9</id>
</test>
<test>
<address>first.last@[12.34.56.78]</address>
<valid>true</valid>
<source>RFC 3696 erratum 1690</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=1690</sourcelink>
<id>10</id>
</test>
<test>
<address>first.last@[IPv6:::12.34.56.78]</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>11</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333::4444:12.34.56.78]</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>12</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.56.78]</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>13</id>
</test>
<test>
<address>first.last@[IPv6:::1111:2222:3333:4444:5555:6666]</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>14</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333::4444:5555:6666]</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>15</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:6666::]</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>16</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>17</id>
</test>
<test>
<address>first.last@x23456789012345678901234567890123456789012345678901234567890123.example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>18</id>
</test>
<test>
<address>first.last@1xample.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>19</id>
</test>
<test>
<address>first.last@123.example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>20</id>
</test>
<test>
<address>123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12.example.com</address>
<valid>false</valid>
<comment>Entire address is longer than 254 characters</comment>
<source>RFC 3696 erratum 1690</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=1690</sourcelink>
<id>21</id>
</test>
<test>
<address>first.last</address>
<valid>false</valid>
<comment>No @</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>22</id>
</test>
<test>
<address>12345678901234567890123456789012345678901234567890123456789012345@example.com</address>
<valid>false</valid>
<comment>Local part more than 64 characters</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>23</id>
</test>
<test>
<address>.first.last@example.com</address>
<valid>false</valid>
<comment>Local part starts with a dot</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>24</id>
</test>
<test>
<address>first.last.@example.com</address>
<valid>false</valid>
<comment>Local part ends with a dot</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>25</id>
</test>
<test>
<address>first..last@example.com</address>
<valid>false</valid>
<comment>Local part has consecutive dots</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>26</id>
</test>
<test>
<address>"first"last"@example.com</address>
<valid>false</valid>
<comment>Local part contains unescaped excluded characters</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>27</id>
</test>
<test>
<address>"first\last"@example.com</address>
<valid>true</valid>
<comment>Any character can be escaped in a quoted string</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>28</id>
</test>
<test>
<address>"""@example.com</address>
<valid>false</valid>
<comment>Local part contains unescaped excluded characters</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>29</id>
</test>
<test>
<address>"\"@example.com</address>
<valid>false</valid>
<comment>Local part cannot end with a backslash</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>30</id>
</test>
<test>
<address>""@example.com</address>
<valid>false</valid>
<comment>Local part is effectively empty</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>31</id>
</test>
<test>
<address>first\\@last@example.com</address>
<valid>false</valid>
<comment>Local part contains unescaped excluded characters</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>32</id>
</test>
<test>
<address>first.last@</address>
<valid>false</valid>
<comment>No domain</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>33</id>
</test>
<test>
<address>x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456</address>
<valid>false</valid>
<comment>Domain exceeds 255 chars</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>34</id>
</test>
<test>
<address>first.last@[.12.34.56.78]</address>
<valid>false</valid>
<comment>Only char that can precede IPv4 address is ':'</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>35</id>
</test>
<test>
<address>first.last@[12.34.56.789]</address>
<valid>false</valid>
<comment>Can't be interpreted as IPv4 so IPv6 tag is missing</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>36</id>
</test>
<test>
<address>first.last@[::12.34.56.78]</address>
<valid>false</valid>
<comment>IPv6 tag is missing</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>37</id>
</test>
<test>
<address>first.last@[IPv5:::12.34.56.78]</address>
<valid>false</valid>
<comment>IPv6 tag is wrong</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>38</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333::4444:5555:12.34.56.78]</address>
<valid>false</valid>
<comment>Too many IPv6 groups (4 max)</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>39</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:12.34.56.78]</address>
<valid>false</valid>
<comment>Not enough IPv6 groups</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>40</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:12.34.56.78]</address>
<valid>false</valid>
<comment>Too many IPv6 groups (6 max)</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>41</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777]</address>
<valid>false</valid>
<comment>Not enough IPv6 groups</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>42</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]</address>
<valid>false</valid>
<comment>Too many IPv6 groups (8 max)</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>43</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222::3333::4444:5555:6666]</address>
<valid>false</valid>
<comment>Too many '::' (can be none or one)</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>44</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777]</address>
<valid>false</valid>
<comment>Too many IPv6 groups (6 max)</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>45</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:333x::4444:5555]</address>
<valid>false</valid>
<comment>x is not valid in an IPv6 address</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>46</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:33333::4444:5555]</address>
<valid>false</valid>
<comment>33333 is not a valid group in an IPv6 address</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>47</id>
</test>
<test>
<address>first.last@example.123</address>
<valid>false</valid>
<comment>TLD can't be all digits</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>48</id>
</test>
<test>
<address>first.last@com</address>
<valid>false</valid>
<comment>Mail host must be second- or lower level</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>49</id>
</test>
<test>
<address>first.last@-xample.com</address>
<valid>false</valid>
<comment>Label can't begin with a hyphen</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>50</id>
</test>
<test>
<address>first.last@exampl-.com</address>
<valid>false</valid>
<comment>Label can't end with a hyphen</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>51</id>
</test>
<test>
<address>first.last@x234567890123456789012345678901234567890123456789012345678901234.example.com</address>
<valid>false</valid>
<comment>Label can't be longer than 63 octets</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>52</id>
</test>
<test>
<address>"Abc\@def"@example.com</address>
<valid>true</valid>
<source>RFC 3696 (February 2004)</source>
<sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink>
<id>53</id>
</test>
<test>
<address>"Fred\ Bloggs"@example.com</address>
<valid>true</valid>
<source>RFC 3696 (as amended by erratum 2005-07-09)</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=246</sourcelink>
<id>54</id>
</test>
<test>
<address>"Joe.\\Blow"@example.com</address>
<valid>true</valid>
<source>RFC 3696 (as amended by erratum 2005-07-09)</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=246</sourcelink>
<id>55</id>
</test>
<test>
<address>"Abc@def"@example.com</address>
<valid>true</valid>
<source>RFC 3696 (as amended by erratum 2005-07-09)</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=246</sourcelink>
<id>56</id>
</test>
<test>
<address>"Fred Bloggs"@example.com</address>
<valid>true</valid>
<source>RFC 3696 (February 2004)</source>
<sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink>
<id>57</id>
</test>
<test>
<address>user+mailbox@example.com</address>
<valid>true</valid>
<source>RFC 3696 (February 2004)</source>
<sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink>
<id>58</id>
</test>
<test>
<address>customer/department=shipping@example.com</address>
<valid>true</valid>
<source>RFC 3696 (February 2004)</source>
<sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink>
<id>59</id>
</test>
<test>
<address>$A12345@example.com</address>
<valid>true</valid>
<source>RFC 3696 (February 2004)</source>
<sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink>
<id>60</id>
</test>
<test>
<address>!def!xyz%abc@example.com</address>
<valid>true</valid>
<source>RFC 3696 (February 2004)</source>
<sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink>
<id>61</id>
</test>
<test>
<address>_somename@example.com</address>
<valid>true</valid>
<source>RFC 3696 (February 2004)</source>
<sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink>
<id>62</id>
</test>
<test>
<address>dclo@us.ibm.com</address>
<valid>true</valid>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>63</id>
</test>
<test>
<address>abc\@def@example.com</address>
<valid>false</valid>
<comment>This example from RFC 3696 was corrected in an erratum</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>64</id>
</test>
<test>
<address>abc\\@example.com</address>
<valid>false</valid>
<comment>This example from RFC 3696 was corrected in an erratum</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>65</id>
</test>
<test>
<address>peter.piper@example.com</address>
<valid>true</valid>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>66</id>
</test>
<test>
<address>Doug\ \"Ace\"\ Lovell@example.com</address>
<valid>false</valid>
<comment>Escaping can only happen in a quoted string</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>67</id>
</test>
<test>
<address>"Doug \"Ace\" L."@example.com</address>
<valid>true</valid>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>68</id>
</test>
<test>
<address>abc@def@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>69</id>
</test>
<test>
<address>abc\\@def@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>70</id>
</test>
<test>
<address>abc\@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>71</id>
</test>
<test>
<address>@example.com</address>
<valid>false</valid>
<comment>No local part</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>72</id>
</test>
<test>
<address>doug@</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>73</id>
</test>
<test>
<address>"qu@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>74</id>
</test>
<test>
<address>ote"@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>75</id>
</test>
<test>
<address>.dot@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>76</id>
</test>
<test>
<address>dot.@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>77</id>
</test>
<test>
<address>two..dot@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>78</id>
</test>
<test>
<address>"Doug "Ace" L."@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>79</id>
</test>
<test>
<address>Doug\ \"Ace\"\ L\.@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>80</id>
</test>
<test>
<address>hello world@example.com</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>81</id>
</test>
<test>
<address>gatsby@f.sc.ot.t.f.i.tzg.era.l.d.</address>
<valid>false</valid>
<comment>Doug Lovell says this should fail</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>82</id>
</test>
<test>
<valid>true</valid>
<address>test@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>83</id>
</test>
<test>
<valid>true</valid>
<address>TEST@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>84</id>
</test>
<test>
<valid>true</valid>
<address>1234567890@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>85</id>
</test>
<test>
<valid>true</valid>
<address>test+test@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>86</id>
</test>
<test>
<valid>true</valid>
<address>test-test@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>87</id>
</test>
<test>
<valid>true</valid>
<address>t*est@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>88</id>
</test>
<test>
<valid>true</valid>
<address>+1~1+@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>89</id>
</test>
<test>
<valid>true</valid>
<address>{_test_}@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>90</id>
</test>
<test>
<valid>true</valid>
<address>"[[ test ]]"@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>91</id>
</test>
<test>
<valid>true</valid>
<address>test.test@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>92</id>
</test>
<test>
<valid>true</valid>
<address>"test.test"@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>93</id>
</test>
<test>
<valid>true</valid>
<address>test."test"@example.com</address>
<comment>Obsolete form, but documented in RFC 5322</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>94</id>
</test>
<test>
<valid>true</valid>
<address>"test@test"@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>95</id>
</test>
<test>
<valid>true</valid>
<address>test@123.123.123.x123</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>96</id>
</test>
<test>
<valid>false</valid>
<address>test@123.123.123.123</address>
<comment>Top Level Domain won't be all-numeric (see RFC 3696 Section 2). I disagree with Dave Child on this one.</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>97</id>
</test>
<test>
<valid>true</valid>
<address>test@[123.123.123.123]</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>98</id>
</test>
<test>
<valid>true</valid>
<address>test@example.example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>99</id>
</test>
<test>
<valid>true</valid>
<address>test@example.example.example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>100</id>
</test>
<test>
<valid>false</valid>
<address>test.example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>101</id>
</test>
<test>
<valid>false</valid>
<address>test.@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>102</id>
</test>
<test>
<valid>false</valid>
<address>test..test@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>103</id>
</test>
<test>
<valid>false</valid>
<address>.test@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>104</id>
</test>
<test>
<valid>false</valid>
<address>test@test@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>105</id>
</test>
<test>
<valid>false</valid>
<address>test@@example.com</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>106</id>
</test>
<test>
<valid>false</valid>
<address>-- test --@example.com</address>
<comment>No spaces allowed in local part</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>107</id>
</test>
<test>
<valid>false</valid>
<address>[test]@example.com</address>
<comment>Square brackets only allowed within quotes</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>108</id>
</test>
<test>
<valid>true</valid>
<address>"test\test"@example.com</address>
<comment>Any character can be escaped in a quoted string</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>109</id>
</test>
<test>
<valid>false</valid>
<address>"test"test"@example.com</address>
<comment>Quotes cannot be nested</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>110</id>
</test>
<test>
<valid>false</valid>
<address>()[]\;:,&gt;&lt;@example.com</address>
<comment>Disallowed Characters</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>111</id>
</test>
<test>
<valid>false</valid>
<comment>Dave Child says so</comment>
<address>test@.</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>112</id>
</test>
<test>
<valid>false</valid>
<comment>Dave Child says so</comment>
<address>test@example.</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>113</id>
</test>
<test>
<valid>false</valid>
<comment>Dave Child says so</comment>
<address>test@.org</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>114</id>
</test>
<test>
<valid>false</valid>
<address>test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com</address>
<comment>255 characters is maximum length for domain. This is 256.</comment>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>115</id>
</test>
<test>
<valid>false</valid>
<comment>Dave Child says so</comment>
<address>test@example</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>116</id>
</test>
<test>
<valid>false</valid>
<comment>Dave Child says so</comment>
<address>test@[123.123.123.123</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>117</id>
</test>
<test>
<valid>false</valid>
<comment>Dave Child says so</comment>
<address>test@123.123.123.123]</address>
<source>Dave Child</source>
<sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink>
<id>118</id>
</test>
<test>
<address>NotAnEmail</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>119</id>
</test>
<test>
<address>@NotAnEmail</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>120</id>
</test>
<test>
<address>"test\\blah"@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>121</id>
</test>
<test>
<address>"test\blah"@example.com</address>
<valid>true</valid>
<comment>Any character can be escaped in a quoted string</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>122</id>
</test>
<test>
<address>"test\&#13;blah"@example.com</address>
<valid>true</valid>
<comment>Quoted string specifically excludes carriage returns unless escaped</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>123</id>
</test>
<test>
<address>"test&#13;blah"@example.com</address>
<valid>false</valid>
<comment>Quoted string specifically excludes carriage returns</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>124</id>
</test>
<test>
<address>"test\"blah"@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>125</id>
</test>
<test>
<address>"test"blah"@example.com</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>126</id>
</test>
<test>
<address>customer/department@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>127</id>
</test>
<test>
<address>_Yosemite.Sam@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>128</id>
</test>
<test>
<address>~@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>129</id>
</test>
<test>
<address>.wooly@example.com</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>130</id>
</test>
<test>
<address>wo..oly@example.com</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>131</id>
</test>
<test>
<address>pootietang.@example.com</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>132</id>
</test>
<test>
<address>.@example.com</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>133</id>
</test>
<test>
<address>"Austin@Powers"@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>134</id>
</test>
<test>
<address>Ima.Fool@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>135</id>
</test>
<test>
<address>"Ima.Fool"@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>136</id>
</test>
<test>
<address>"Ima Fool"@example.com</address>
<valid>true</valid>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>137</id>
</test>
<test>
<address>Ima Fool@example.com</address>
<valid>false</valid>
<comment>Phil Haack says so</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>138</id>
</test>
<test>
<address>phil.h\@\@ck@haacked.com</address>
<valid>false</valid>
<comment>Escaping can only happen in a quoted string</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>139</id>
</test>
<test>
<address>"first"."last"@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>140</id>
</test>
<test>
<address>"first".middle."last"@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>141</id>
</test>
<test>
<address>"first\\"last"@example.com</address>
<valid>false</valid>
<comment>Contains an unescaped quote</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>142</id>
</test>
<test>
<address>"first".last@example.com</address>
<valid>true</valid>
<comment>obs-local-part form as described in RFC 5322</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>143</id>
</test>
<test>
<address>first."last"@example.com</address>
<valid>true</valid>
<comment>obs-local-part form as described in RFC 5322</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>144</id>
</test>
<test>
<address>"first"."middle"."last"@example.com</address>
<valid>true</valid>
<comment>obs-local-part form as described in RFC 5322</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>145</id>
</test>
<test>
<address>"first.middle"."last"@example.com</address>
<valid>true</valid>
<comment>obs-local-part form as described in RFC 5322</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>146</id>
</test>
<test>
<address>"first.middle.last"@example.com</address>
<valid>true</valid>
<comment>obs-local-part form as described in RFC 5322</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>147</id>
</test>
<test>
<address>"first..last"@example.com</address>
<valid>true</valid>
<comment>obs-local-part form as described in RFC 5322</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>148</id>
</test>
<test>
<address>foo@[\1.2.3.4]</address>
<valid>false</valid>
<comment>RFC 5321 specifies the syntax for address-literal and does not allow escaping</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>149</id>
</test>
<test>
<address>"first\\\"last"@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>150</id>
</test>
<test>
<address>first."mid\dle"."last"@example.com</address>
<valid>true</valid>
<comment>Backslash can escape anything but must escape something</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>151</id>
</test>
<test>
<address>Test.&#13;&#10; Folding.&#13;&#10; Whitespace@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>152</id>
</test>
<test>
<address>first."".last@example.com</address>
<valid>false</valid>
<comment>Contains a zero-length element</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>153</id>
</test>
<test>
<address>first\last@example.com</address>
<valid>false</valid>
<comment>Unquoted string must be an atom</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>154</id>
</test>
<test>
<address>Abc\@def@example.com</address>
<valid>false</valid>
<comment>Was incorrectly given as a valid address in the original RFC 3696</comment>
<source>RFC 3696 erratum 246</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=246</sourcelink>
<id>155</id>
</test>
<test>
<address>Fred\ Bloggs@example.com</address>
<valid>false</valid>
<comment>Was incorrectly given as a valid address in the original RFC 3696</comment>
<source>RFC 3696 erratum 246</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=246</sourcelink>
<id>156</id>
</test>
<test>
<address>Joe.\\Blow@example.com</address>
<valid>false</valid>
<comment>Was incorrectly given as a valid address in the original RFC 3696</comment>
<source>RFC 3696 erratum 246</source>
<sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&amp;eid=246</sourcelink>
<id>157</id>
</test>
<test>
<address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89]</address>
<valid>false</valid>
<comment>IPv4 part contains an invalid octet</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>158</id>
</test>
<test>
<address>"test\&#13;&#10; blah"@example.com</address>
<valid>false</valid>
<comment>Folding white space can't appear within a quoted pair</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>159</id>
</test>
<test>
<address>"test&#13;&#10; blah"@example.com</address>
<valid>true</valid>
<comment>This is a valid quoted string with folding white space</comment>
<source>Phil Haack</source>
<sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink>
<id>160</id>
</test>
<test>
<address>{^c\@**Dog^}@cartoon.com</address>
<valid>false</valid>
<comment>This is a throwaway example from Doug Lovell's article. Actually it's not a valid address.</comment>
<source>Doug Lovell (LinuxJournal, June 2007)</source>
<sourcelink>http://www.linuxjournal.com/article/9585</sourcelink>
<id>161</id>
</test>
<test>
<address>(foo)cal(bar)@(baz)iamcal.com(quux)</address>
<valid>true</valid>
<comment>A valid address containing comments</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>162</id>
</test>
<test>
<address>cal@iamcal(woo).(yay)com</address>
<valid>true</valid>
<comment>A valid address containing comments</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>163</id>
</test>
<test>
<address>"foo"(yay)@(hoopla)[1.2.3.4]</address>
<valid>false</valid>
<comment>Address literal can't be commented (RFC 5321)</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>164</id>
</test>
<test>
<address>cal(woo(yay)hoopla)@iamcal.com</address>
<valid>true</valid>
<comment>A valid address containing comments</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>165</id>
</test>
<test>
<address>cal(foo\@bar)@iamcal.com</address>
<valid>true</valid>
<comment>A valid address containing comments</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>166</id>
</test>
<test>
<address>cal(foo\)bar)@iamcal.com</address>
<valid>true</valid>
<comment>A valid address containing comments and an escaped parenthesis</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>167</id>
</test>
<test>
<address>cal(foo(bar)@iamcal.com</address>
<valid>false</valid>
<comment>Unclosed parenthesis in comment</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>168</id>
</test>
<test>
<address>cal(foo)bar)@iamcal.com</address>
<valid>false</valid>
<comment>Too many closing parentheses</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>169</id>
</test>
<test>
<address>cal(foo\)@iamcal.com</address>
<valid>false</valid>
<comment>Backslash at end of comment has nothing to escape</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>170</id>
</test>
<test>
<address>first().last@example.com</address>
<valid>true</valid>
<comment>A valid address containing an empty comment</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>171</id>
</test>
<test>
<address>first.(&#13;&#10; middle&#13;&#10; )last@example.com</address>
<valid>true</valid>
<comment>Comment with folding white space</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>172</id>
</test>
<test>
<address>first(12345678901234567890123456789012345678901234567890)last@(1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890)example.com</address>
<valid>false</valid>
<comment>Too long with comments, not too long without</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>173</id>
</test>
<test>
<address>first(Welcome to&#13;&#10; the ("wonderful" (!)) world&#13;&#10; of email)@example.com</address>
<valid>true</valid>
<comment>Silly example from my blog post</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>174</id>
</test>
<test>
<address>pete(his account)@silly.test(his host)</address>
<valid>true</valid>
<comment>Canonical example from RFC 5322</comment>
<source>RFC 5322</source>
<sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink>
<id>175</id>
</test>
<test>
<address>c@(Chris's host.)public.example</address>
<valid>true</valid>
<comment>Canonical example from RFC 5322</comment>
<source>RFC 5322</source>
<sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink>
<id>176</id>
</test>
<test>
<address>jdoe@machine(comment). example</address>
<valid>true</valid>
<comment>Canonical example from RFC 5322</comment>
<source>RFC 5322</source>
<sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink>
<id>177</id>
</test>
<test>
<address>1234 @ local(blah) .machine .example</address>
<valid>true</valid>
<comment>Canonical example from RFC 5322</comment>
<source>RFC 5322</source>
<sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink>
<id>178</id>
</test>
<test>
<address>first(middle)last@example.com</address>
<valid>false</valid>
<comment>Can't have a comment or white space except at an element boundary</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>179</id>
</test>
<test>
<address>first(abc.def).last@example.com</address>
<valid>true</valid>
<comment>Comment can contain a dot</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>180</id>
</test>
<test>
<address>first(a"bc.def).last@example.com</address>
<valid>true</valid>
<comment>Comment can contain double quote</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>181</id>
</test>
<test>
<address>first.(")middle.last(")@example.com</address>
<valid>true</valid>
<comment>Comment can contain a quote</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>182</id>
</test>
<test>
<address>first(abc("def".ghi).mno)middle(abc("def".ghi).mno).last@(abc("def".ghi).mno)example(abc("def".ghi).mno).(abc("def".ghi).mno)com(abc("def".ghi).mno)</address>
<valid>false</valid>
<comment>Can't have comments or white space except at an element boundary</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>183</id>
</test>
<test>
<address>first(abc\(def)@example.com</address>
<valid>true</valid>
<comment>Comment can contain quoted-pair</comment>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>184</id>
</test>
<test>
<address>first.last@x(1234567890123456789012345678901234567890123456789012345678901234567890).com</address>
<valid>true</valid>
<comment>Label is longer than 63 octets, but not with comment removed</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>185</id>
</test>
<test>
<address>a(a(b(c)d(e(f))g)h(i)j)@example.com</address>
<valid>true</valid>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>186</id>
</test>
<test>
<address>a(a(b(c)d(e(f))g)(h(i)j)@example.com</address>
<valid>false</valid>
<comment>Braces are not properly matched</comment>
<source>Cal Henderson</source>
<sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink>
<id>187</id>
</test>
<test>
<address>name.lastname@domain.com</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>188</id>
</test>
<test>
<address>.@</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>189</id>
</test>
<test>
<address>a@b</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>190</id>
</test>
<test>
<address>@bar.com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>191</id>
</test>
<test>
<address>@@bar.com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>192</id>
</test>
<test>
<address>a@bar.com</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>193</id>
</test>
<test>
<address>aaa.com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>194</id>
</test>
<test>
<address>aaa@.com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>195</id>
</test>
<test>
<address>aaa@.123</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>196</id>
</test>
<test>
<address>aaa@[123.123.123.123]</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>197</id>
</test>
<test>
<address>aaa@[123.123.123.123]a</address>
<valid>false</valid>
<comment>extra data outside ip</comment>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>198</id>
</test>
<test>
<address>aaa@[123.123.123.333]</address>
<valid>false</valid>
<comment>not a valid IP</comment>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>199</id>
</test>
<test>
<address>a@bar.com.</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>200</id>
</test>
<test>
<address>a@bar</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>201</id>
</test>
<test>
<address>a-b@bar.com</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>202</id>
</test>
<test>
<address>+@b.c</address>
<valid>true</valid>
<comment>TLDs can be any length</comment>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>203</id>
</test>
<test>
<address>+@b.com</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>204</id>
</test>
<test>
<address>a@-b.com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>205</id>
</test>
<test>
<address>a@b-.com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>206</id>
</test>
<test>
<address>-@..com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>207</id>
</test>
<test>
<address>-@a..com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>208</id>
</test>
<test>
<address>a@b.co-foo.uk</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>209</id>
</test>
<test>
<address>"hello my name is"@stutter.com</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>210</id>
</test>
<test>
<address>"Test \"Fail\" Ing"@example.com</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>211</id>
</test>
<test>
<address>valid@special.museum</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>212</id>
</test>
<test>
<address>invalid@special.museum-</address>
<valid>false</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>213</id>
</test>
<test>
<address>shaitan@my-domain.thisisminekthx</address>
<valid>true</valid>
<comment>Disagree with Paul Gregg here</comment>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>214</id>
</test>
<test>
<address>test@...........com</address>
<valid>false</valid>
<comment>......</comment>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>215</id>
</test>
<test>
<address>foobar@192.168.0.1</address>
<valid>false</valid>
<comment>ip need to be []</comment>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>216</id>
</test>
<test>
<address>"Joe\\Blow"@example.com</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>217</id>
</test>
<test>
<address>Invalid \&#10; Folding \&#10; Whitespace@example.com</address>
<valid>false</valid>
<source>Paul Gregg</source>
<comment>This isn't FWS so Dominic Sayers says it's invalid</comment>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>218</id>
</test>
<test>
<address>HM2Kinsists@(that comments are allowed)this.is.ok</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>219</id>
</test>
<test>
<address>user%uucp!path@somehost.edu</address>
<valid>true</valid>
<source>Paul Gregg</source>
<sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink>
<id>220</id>
</test>
<test>
<address>"first(last)"@example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>221</id>
</test>
<test>
<address> &#13;&#10; (&#13;&#10; x &#13;&#10; ) &#13;&#10; first&#13;&#10; ( &#13;&#10; x&#13;&#10; ) &#13;&#10; .&#13;&#10; ( &#13;&#10; x) &#13;&#10; last &#13;&#10; ( x &#13;&#10; ) &#13;&#10; @example.com</address>
<valid>true</valid>
<source>Dominic Sayers</source>
<sourcelink>http://www.dominicsayers.com/isemail</sourcelink>
<id>222</id>
</test>
<test>
<address>test. &#13;&#10; &#13;&#10; obs@syntax.com</address>
<valid>true</valid>
<comment>obs-fws allows multiple lines</comment>
<source>George Pollard</source>
<sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink>
<id>223</id>
</test>
<test>
<address>test. &#13;&#10; &#13;&#10; obs@syntax.com</address>
<valid>true</valid>
<comment>obs-fws allows multiple lines (test 2: space before break)</comment>
<source>George Pollard</source>
<sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink>
<id>224</id>
</test>
<test>
<address>test.&#13;&#10;&#13;&#10; obs@syntax.com</address>
<valid>false</valid>
<comment>obs-fws must have at least one WSP per line</comment>
<source>George Pollard</source>
<sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink>
<id>225</id>
</test>
<test>
<address>"null \\0"@char.com</address>
<valid>true</valid>
<comment>can have escaped null character</comment>
<source>George Pollard</source>
<sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink>
<id>226</id>
</test>
<test>
<address>"null \0"@char.com</address>
<valid>false</valid>
<comment>cannot have unescaped null character</comment>
<source>George Pollard</source>
<sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink>
<id>227</id>
</test>
<test>
<address>null\\0@char.com</address>
<valid>false</valid>
<comment>escaped null must be in quoted string</comment>
<source>George Pollard</source>
<sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink>
<id>228</id>
</test>
<test>
<address>cdburgess+!#$%&amp;'*-/=?+_{}|~test@gmail.com</address>
<valid>true</valid>
<comment>Example given in comments</comment>
<source>http://www.dominicsayers.com/isemail/#comment-30024957</source>
<sourcelink>cdburgess</sourcelink>
<id>229</id>
</test>
</tests>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/ViaThinkSoft Java Utils/test/com/iamcal/rfc3696/RFC3696EmailParserTest.java
90,8 → 90,8
// Now check the XML testcases
checkXML("test/emailSayersTests.xml");
checkXML("test/emailExperimentalTests.xml");
checkXML("test/eMailTests/SayersTests.xml");
checkXML("test/eMailTests/ExperimentalTests.xml");
 
if (errorCount > 0) {
System.err.println("==> " + errorCount + " ERRORS OCCOURED! <==");
/ViaThinkSoft Java Utils/test/com/dominicsayers/isemail/IsEMailTest.java
91,8 → 91,8
// Now check the XML testcases
checkXML("test/emailSayersTests.xml");
checkXML("test/emailExperimentalTests.xml");
checkXML("test/eMailTests/SayersTests.xml");
checkXML("test/eMailTests/ExperimentalTests.xml");
 
if (errorCount > 0) {
System.err.println("==> " + errorCount + " ERRORS OCCOURED! <==");
/ViaThinkSoft Java Utils/src/de/viathinksoft/utils/mail/sender/PlainTextMailSender.java
3,27 → 3,24
import javax.mail.MessagingException;
 
import de.viathinksoft.utils.mail.EMailAddress;
import de.viathinksoft.utils.mail.InvalidMailAddressException;
 
public class PlainTextMailSender extends RawMailSender {
// --- E-Mail-Adressobjekt benutzen (dekodiert automatisch den Punycode)
public void setMailFrom(String mailFrom) throws InvalidMailAddressException {
public void setMailFrom(String mailFrom) {
this.setMailFrom(new EMailAddress(mailFrom));
}
 
public void setMailFrom(EMailAddress mailFrom) throws InvalidMailAddressException {
if (mailFrom == null) throw new InvalidMailAddressException();
public void setMailFrom(EMailAddress mailFrom) {
super.setMailFrom(mailFrom.getMailAddressPunycodedDomain());
}
 
public void setRecipient(String recipient) throws InvalidMailAddressException {
public void setRecipient(String recipient) {
this.setRecipient(new EMailAddress(recipient));
}
 
public void setRecipient(EMailAddress recipient) throws InvalidMailAddressException {
if (recipient == null) throw new InvalidMailAddressException();
public void setRecipient(EMailAddress recipient) {
super.setRecipient(recipient.getMailAddressPunycodedDomain());
}
/ViaThinkSoft Java Utils/src/de/viathinksoft/utils/mail/sender/RawMailSender.java
14,8 → 14,6
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
 
import de.viathinksoft.utils.mail.InvalidMailAddressException;
 
abstract public class RawMailSender {
 
private static final String TRANSPORT_PROTOCOL = "smtp";
40,8 → 38,7
return mailFrom;
}
 
public void setMailFrom(String mailFrom) throws InvalidMailAddressException {
if (mailFrom == null) throw new InvalidMailAddressException();
public void setMailFrom(String mailFrom) {
this.mailFrom = mailFrom.trim();
}
 
49,8 → 46,7
return recipient;
}
 
public void setRecipient(String recipient) throws InvalidMailAddressException {
if (recipient == null) throw new InvalidMailAddressException();
public void setRecipient(String recipient) {
this.recipient = recipient.trim();
}
 
/ViaThinkSoft Java Utils/src/de/viathinksoft/utils/mail/syntaxchecker/MailSyntaxChecker.java
5,11 → 5,13
import java.util.regex.Pattern;
 
import de.viathinksoft.utils.mail.EMailAddress;
import de.viathinksoft.utils.mail.InvalidMailAddressException;
 
/**
* This class is not stable. For a good syntax check, please use the classes of
* Dominic Sayers or Cal Henderson.
*
* @author Daniel Marschall
* @version 0.1
*
*/
public class MailSyntaxChecker {
104,8 → 106,7
return true;
}
 
public static boolean isMailValid(String email)
throws InvalidMailAddressException {
public static boolean isMailValid(String email) {
return isMailValid(new EMailAddress(email));
}
 
135,19 → 136,17
}
 
// localPart darf keine Punkte am Anfang oder Ende besitzen
if (localPart.length() == 0) return false;
String lpFirstChar = localPart.substring(0, 1);
String lpLastChar = localPart.substring(localPart.length()-1);
if (lpFirstChar.equals(".") || (lpLastChar.equals("."))) {
if (localPart.length() == 0) {
return false;
}
if (localPart.startsWith(".") || localPart.endsWith(".")) {
return false;
}
 
// domainPart darf keine Punkte am Anfang oder Ende besitzen
 
String dpFirstChar = domainPart.substring(0, 1);
String dpLastChar = domainPart.substring(domainPart.length()-1);
 
if (dpFirstChar.equals(".") || (dpLastChar.equals("."))) {
if (domainPart.startsWith(".") || domainPart.endsWith(".")) {
return false;
}
 
160,7 → 159,8
String ip = ""; // TODO
if (CHECK_DNS) {
if (!checkDns(ip)) return false;
if (!checkDns(ip))
return false;
}
} else if (preg_match("^\\["+REGEX_IP+"\\]$", domainPart)) {
// domainPart is [<IP>]
168,7 → 168,8
String ip = ""; // TODO
if (CHECK_DNS) {
if (!checkDns(ip)) return false;
if (!checkDns(ip))
return false;
}
} else {
if (!preg_match("^[A-Za-z0-9\\-\\.]+$", domainPart)) {
181,7 → 182,8
}
if (CHECK_DNS) {
if (!checkDns(domainPart)) return false;
if (!checkDns(domainPart))
return false;
}
}
191,8 → 193,8
localPart.replaceAll("\\\\", "").replaceAll("@", "") )) {
// character not valid in local part unless
// local part is quoted
if (!preg_match("^\"(\\\\\"|[^\"])+\"$",
localPart.replaceAll("\\\\", "").replaceAll("@", "") )) {
if (!preg_match("^\"(\\\\\"|[^\"])+\"$", localPart.replaceAll(
"\\\\", "").replaceAll("@", ""))) {
return false;
}
}
/ViaThinkSoft Java Utils/src/de/viathinksoft/utils/mail/EMailAddress.java
2,8 → 2,6
 
import java.net.IDN;
 
import de.viathinksoft.utils.mail.syntaxchecker.MailSyntaxChecker;
 
/**
*
* This class parses an email address (trims whitespaces from it) and stores it
122,30 → 120,25
* bare computer email address. e.g. roedyg@mindprod.com No
* "Roedy Green" <roedyg@mindprod.com> style addresses. No local
* addresses, e.g. roedy.
* @throws InvalidMailAddressException
*/
public EMailAddress(String eMailAddress) throws InvalidMailAddressException {
public EMailAddress(String eMailAddress) {
super();
 
if (eMailAddress == null) {
throw new InvalidMailAddressException();
}
// Zuerst trimmen (z.B. für Formulardaten)
eMailAddress = eMailAddress.trim();
 
// Zuerst trimmen (z.B. für Formulardaten) Wir splitten dann beim
// At-Zeichen (@) und berücksichtigen ein escaped-At
// (\@)
String[] res = eMailAddress.trim().split("(?<!\\\\)@");
 
// @-sign was not used once
if (res.length != 2) {
throw new InvalidMailAddressException();
// Wir splitten dann beim At-Zeichen (@)
String localPart = "";
String domainPart = "";
int atIndex = eMailAddress.lastIndexOf('@');
if (atIndex == -1) {
localPart = eMailAddress;
domainPart = "";
} else {
localPart = eMailAddress.substring(0, atIndex);
domainPart = eMailAddress.substring(atIndex + 1);
}
 
// Temporary we store the values here.
 
String localPart = res[0];
String domainPart = res[1];
 
// We parse the local part.
 
if (localPart == null)
191,14 → 184,18
// Methods
 
/**
* Returns the email address with punycoded domain name and TLD. You should use
* this method to send emails.
* Returns the email address with punycoded domain name and TLD. You should
* use this method to send emails.
*
* @return The email address with punycoded domain name and TLD.
*/
public String getMailAddressPunycodedDomain() {
if (this.domainPartPunycode.equals("")) {
return this.localPart;
} else {
return this.localPart + "@" + this.domainPartPunycode;
}
}
 
/**
* Returns the email address with internationalized domain names and TLD.
206,8 → 203,12
* @return The email address with internationalized domain name and TLD.
*/
public String getMailAddressUnicode() {
if (this.domainPartUnicode.equals("")) {
return this.localPart;
} else {
return this.localPart + "@" + this.domainPartUnicode;
}
}
 
/**
* Returns a string which represents the mail address. If the constant
279,27 → 280,9
*/
@Override
protected EMailAddress clone() throws CloneNotSupportedException {
try {
return new EMailAddress(this.toString());
} catch (InvalidMailAddressException e) {
return null;
}
}
 
/**
* Asks the mail syntax checker if the current mail address is valid or not.
* Warning! This check is NOT performed automatically. There is no guarantee
* that the syntax check is 100% correct. There might be mail address which
* are valid but marked as invalid (because server disobeyed RFC rules etc)
* and mail addresses which are invalid but marked valid (e.g. simply if
* they were not assigned).
*
* @return Boolean which represents if the mail address is valid or not.
*/
public boolean isSyntaxValid() {
return MailSyntaxChecker.isMailValid(this);
}
 
// ---------- STATIC FUNCTIONS ----------
 
/**
310,8 → 293,9
* @return Boolean which shows if the string is not yet punicoded.
*/
protected static boolean isUnicode(String str) {
if (str == null)
if (str == null) {
return false;
}
return (!IDN.toASCII(str).equals(str));
}
 
323,8 → 307,9
* @return Boolean which shows if the string is punycoded or not.
*/
protected static boolean isPunycode(String str) {
if (str == null)
if (str == null) {
return false;
}
return (!IDN.toUnicode(str).equals(str));
}
}
/ViaThinkSoft Java Utils/src/de/viathinksoft/utils/mail/EMailPreprocessor.java
12,7 → 12,7
*/
public class EMailPreprocessor {
public static String preprocess(String eMailAddress) throws InvalidMailAddressException {
public static String preprocess(String eMailAddress) {
EMailAddress email = new EMailAddress(eMailAddress);
return email.getMailAddressPunycodedDomain();
/ViaThinkSoft Java Utils/src/de/viathinksoft/utils/mail/InvalidMailAddressException.java
1,5 → 1,6
package de.viathinksoft.utils.mail;
 
@Deprecated
public class InvalidMailAddressException extends Exception {
 
private static final long serialVersionUID = -3748914913077717465L;