The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Error when adding a campaign

Highlighted
Occasional Contributor

Error when adding a campaign

Hi,

 

I am trying to create an email campaign using the .NET CTCT Wrapper Library and I getting the below error. I've copied the generated JSON as well.

 

CtctException thrown:
Error message: http.status.bad_request:Please enter a valid email address.

 

Below is the code for adding campaign parameters.

Private Function CreateCampaignInputs() As EmailCampaign
        Dim campaign As New EmailCampaign
        campaign.Id = "1001"
        campaign.Name = "Account Activity Alert"
        campaign.Subject = "Account Activity Alert"
        campaign.FromName = "INFO-Automation "
        campaign.FromEmail = "infoFrom@mail.com"
        campaign.ReplyToEmail = "Webmaster@mail.com"
        campaign.EmailContentFormat = CampaignEmailFormat.HTML
        campaign.GreetingString = "Hello Greeting String"
        campaign.EmailContent = "<html xmlns=""http://www.w3.org/1999/xhtml""><head><title></title></head><body>Email Content</body></html>"
        campaign.TextContent = "Text Content: Hello"

        ''Message footer settings
        Dim msgFooter As New MessageFooter
        msgFooter.OrganizationName = "MY Organization"
        msgFooter.AddressLine1 = "Address1"
        msgFooter.City = "CITY"
        msgFooter.State = "CA"
        msgFooter.Country = "USA"
        msgFooter.ForwardEmailLinkText = "webmaster@mail.com"
        msgFooter.IncludeSubscribeLink = False

        campaign.MessageFooter = msgFooter

        Return campaign
    End Function

Below is the generate JSON  from the aboive method.

{
\"email_content\": \"<htmlxmlns=\\\"http: \\/\\/www.w3.org\\/1999\\/xhtml\\\"><head><title><\\/title><\\/head><body>EmailContent<\\/body><\\/html>\"...
\"email_content_format\": \"HTML\",
\"from_email\": \"infoFrom@mail.com\",
\"from_name\": \"INFO-Automation\",
\"greeting_string\": \"HelloGreetingString\",
\"id\": \"1001\",
\"message_footer\": {
\"address_line_1\": \"Address1\",
\"city\": \"CITY\",
\"country\": \"USA\",
\"forward_email_link_text\": \"webmaster@mail.com\",
\"organization_name\": \"MYOrganization\",
\"state\": \"CA\"
},
\"name\": \"AccountActivityAlert\",
\"reply_to_email\": \"Webmaster@mail.com\",
\"subject\": \"AccountActivityAlert\",
\"text_content\": \"TextContent: Hello\"
}

JSON Error:

 

Parse error on line 1:
{ \"email_content\": \
-----^
Expecting 'STRING', '}'

 

Am I missing any of the required parameters? Please advise.

 

Thanks

4 REPLIES 4
Highlighted
Occasional Advisor

Re: Error when adding a campaign

Have you verified the email address that you are using as your "FromEmail" using the Constant Contact Email verification process (you do this by logging into your Constant Contact Account and then find the verify email address section for your account).

Highlighted
Honored Contributor

Re: Error when adding a campaign


@KarlH61 wrote:

Have you verified the email address that you are using as your "FromEmail" using the Constant Contact Email verification process (you do this by logging into your Constant Contact Account and then find the verify email address section for your account).


Hello,

 

I wanted to jump in here to say that the solution offered here is likely to be the right answer. Constant Contact requires that the From and Reply-to email addresses on every campaign are verified in your Constant Contact account. You can verify email addresses at any time by following these steps: http://knowledgebase.constantcontact.com/articles/KnowledgeBase/5497

 

Best Regards,

Elijah G.
API Support Engineer
Highlighted
Occasional Contributor

Re: Error when adding a campaign

KarlH & Elijah,

 

Thanks for the suggestion. I

I am getting the same error after verification. Getting the attached exception evern before I received the below one

EmailCampaign.JPG

 


EmailCampaign1.JPG
Highlighted
Employee

Re: Error when adding a campaign

Hi Kumar,

 

Sorry for the delayed response here. If you're still having this issue, can you show the code where you're setting the from address? Could you also make sure that the kumarjp@ email address is getting passed into it properly, if it's not obvious from the code? Thanks!

 

Best Regards,

Shannon Wallace

Partner API Support Engineer

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured