Email address containing a dash (hyphen) not a valid FROM address when creating an email campaign?

PeterM788
Rookie
0 Votes

We are using a code snippet like the one below to create a new email campaign. Our client uses verified email addresses at a domain like this  example@domainwith-dash.com. When they try to create the campaign using this domain as their FROM address, the API returns: 

Please enter a valid email address.

When we verify and use a different FROM email address with a different domain (without the hyphen), and use the same code the email processes through the API without error.

 

Is there something we need to do to encode the FROM email address to pass through and be validated correctly by the API? Or is it possible something else could be the cause? Thanks in advance for any help people can provide.

 

    public function createCampaign($lists, $campaign_title, $subject, $from_name, $from_email, $content_html, $content_text, $reply_to){
        $this->error = '';
        $camp_result['success'] = true;
        $camp_result['error'] = '';
        $camp_result['cid'] = 0;

        $campaign = new Campaign();
        $campaign->name = $campaign_title;
        $campaign->subject = $subject;
        $campaign->from_name = $from_name;
        $campaign->from_email = $from_email;
        $campaign->reply_to_email = $reply_to;
        $campaign->text_content = '<text>' . $content_text. '</text>';
        $campaign->email_content = "<html><body>" .$content_html. "<OpenTracking/></body></html>";
        $campaign->email_content_format = "HTML";
        $campaign->greeting_name = 'FIRST_NAME';
        $campaign->greeting_salutations = 'Dear';
        $campaign->greeting_string = '';

        // add the selected list or lists to the campaign
        if ($lists) {
            foreach ($lists as $list) {
                $campaign->addList($list);
            }
        }
3 REPLIES 3
David_B.
Employee
0 Votes

Hello,

 

Thank you for reaching out to Constant Contact API Support.


You should be able to use a from address which contains a hyphen as long as the address is a verified address on the account. I just tested this in my own account to verify.

 

I'd be happy to look into this for you in more detail. Please send an email to webservices@constantcontact.com with the Constant Contact username and the from/reply email addresses you are seeing this with and we can do some further testing on our end.

 

Sincerely,
David B.
Tier II API Support Engineer

PeterM788
Rookie
0 Votes

Thank you for responding. I will share how this problem was resolved so others can see. The use of the hyphen within the email address does in fact work. However, what we discovered is that when the email address that we provide through the API is compared to the verified email address in Constant Contact the operation is case-sensitive. That is, if the verified email address is bill.smith@example-domain.com and the user of our system supplies a FROM email address that is Bill.Smith@example-domain.com, there will be a mismatch and the server responds with an error.

 

 

We looked around and there are varying opinions as to whether mixing case within an email address should make a difference. Many (maybe most) email systems do not seem to treat case as significant and emails are delivered to addresses despite differences in case. Strictly: The domain portion is definitely not case-sensitive - but the user address might be. 

 

Does Constant Contact automatically convert all email addresses to lowercase? If so, I suppose we could do the same.

 

In general, I would argue that the match against the verified email address should not be case sensitive. It requires extra complexity on the part of the user to be told they need to be careful of case when entering emails even though it does not matter in any other system they use. 

 

David_B.
Employee
0 Votes

Hello,

 

When an address is verified within a Constant Contact account, it will always be stored in our system as lowercase. So the simplest solution would be to convert the address to lowercase before submitting the email campaign.

 

I have provided feedback to our development team about this on your behalf.

 

Please let me know if you have any other questions!

Regards,
David B.
Tier II API Support Engineer

Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up