We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Complex email addresses are being rejected by the API

nhp_bestbuy
Participant

Complex email addresses are being rejected by the API

I'd like to use your service for tracking emails from a facebook application.  Facebook uses a complex email proxy system, one that protects the privacy of its users.  The resulting email is odd, but real and valid.  Using these emails in the API produces a 400 error, "Invalid email"


Here's the XML I sent via ATOM:



<entry xmlns="http://www.w3.org/2005/Atom">
<title type="text"> </title>
<updated>2009-11-19T23:30:28-05:00</updated>
<author></author>
<id>data:,none</id>
<summary type="text">Contact</summary>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
<EmailAddress>apps+15228999956380.680570812.d6dfb3ab6186dc64d75526be1db8d6d8@proxymail.facebook.com</EmailAddress>
<FirstName>Scott</FirstName>
<LastName>***</LastName>
<PostalCode>88888</PostalCode>
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
<ContactLists>
<ContactList id="https://api.constantcontact.com/ws/customers/nhp_bbym/lists/1" />
</ContactLists>
</Contact>
</content>
</entry>


The servers then said

Error 400: The provided email address
apps+152281556380.680570812.d6dfb3ab6186dc64d75526be1db8d6d8@proxymail.facebook.com
was not valid

Can you help? Is there a way to go around your filters?

Thanks!
Scott



7 REPLIES 7
jamesbensonuk
Regular Participant

You need to html encode the + sign in the email address I think.

James Benson, PHP Developer.


Constant Contact Services: http://integrationservic.es/

JasonK880
Occasional Participant

I had a + email address fail as well. Why would I have to URL encode this in the PHP SDK? It should handle that fine through the JSON serialization. Trying to port my system over to Constant Contact, but your email validation rules are overly strict.

I did some testing against the API directly and was able to add both a .us email address and an email address with a + sign in it (not encoded in any way).  If you're recieving errors, it is highly likely it could be a bug in the PHP SDK.  Is there any way you can capture the JSON that is being created and share that with us either in a PM or via email? 

 

We do not have any restrictions on those characters in our contact validation though so it definitely sounds like a formatting or transport error.

Dave Berard
Senior Product Manager, Constant Contact
DaveBerard
Moderator

It should be noted we do not support email addresses over 80 characters in length, that is total including both the domain, local address and @ sign.  The address you are specifying is 83 characters in total so it will not be supported.

Dave Berard
Senior Product Manager, Constant Contact
DealR
Occasional Participant

The API also rejects short emails like: a@b.c. This is understandable. However, I have 2 questions:

 

  1. Is there a way to check if an email is valid or not before calling the API to create a contact.
  2. Is it possible for CC to provide all the rules that an email has to comply in order to be valid. This will help client program to validate email before trying to talk to CC API.

Thanks.

Question you asked is a really good one.  While we don't have documentation anywhere on the validation, I did go into our validation code to pull out all of our rules to get you your answer.  I'm going to update our API documentation to reflect this information as well to help future developers.  Let me know if you have any qusetions.

 

Minimum Length = 6 characters total, including @ and . characters

Maximum Length = 80 characters total, including @ and . characters

 

Local Name Limitations:

Quoted local names can have all ASCII characters, including backspace escaped quotes (\"), from the ASCII character table with values lower than 126 except for all control characters

Unquoted local names can have all ASCII characters from the ASCII character table with values lower than 126 except for: all control characters, space, angle brackets, parentheses, square brackets, comma, colon, semicolon, backslash, double quote and ampersand

 

Domain Name Limitations:

The only valid characters for domain name are: a-z, A-Z, 0-9 and -

Domain Name can have sub-domains (subdomain.domain.com), consecutive . are considered invalid as a domain names must consist of at least 1 character

IP addresses are not a valid domain name for email addresses in our system

 

If an email address passes all of these validation rules, we consider it a valid email address.  Hope this helps.

 

Dave Berard
Senior Product Manager, Constant Contact
JasonK880
Occasional Participant

I get a validation error on this email address. Why?

 

info@vividop.us

 

Looks valid to me. Do you not support .us domains?

Developer Portal

View API documentation, code samples, get your API key.

Visit Page