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.

Opting back in a contact on Do Not Mail list doesn't work.

Highlighted
Retail

Opting back in a contact on Do Not Mail list doesn't work.

I've attempted to set up our custom signup form (http://georgesmusic.com/pages/newsletter) to opt contacts back in who are on the Do Not Mail list, based on the API documentation here: http://community.constantcontact.com/t5/Documentation/Opting-in-a-Contact/ba-p/25115

 

I've had no luck getting it to work. The user stays on the Do Not Mail list, and it sends them a Welcome email, instead of a Resubscribe confirmation.

 

Here is the code generating the XML being sent:

 

$postdata = '<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<entry xmlns="http://www.w3.org/2005/Atom">';
if ($_POST['id'])	$postdata .= '
  <id>http://api.constantcontact.com/ws/customers/btrevena/contacts/'.$_POST['id'].'</id>';
else	$postdata .= '
  <id>data:,none</id>';
$postdata .= '
  <title type="text">Contact: '.$_POST['email'].'</title>
  <updated>'.date('c').'</updated>
  <author>
    <name>Constant Contact</name>
  </author>
  <content type="application/vnd.ctct+xml">
    <Contact xmlns="http://ws.constantcontact.com/ns/1.0/"';
if ($_POST['id'])
	$postdata .= ' id="http://api.constantcontact.com/ws/customers/btrevena/contacts/'.$_POST['id'].'"';
$postdata .= '>
      <Status>Active</Status>
      <EmailAddress>'.$_POST['email'].'</EmailAddress>
      <FirstName>'.$_POST['first'].'</FirstName>
      <LastName>'.$_POST['last'].'</LastName>
      <OptInSource>ACTION_BY_CONTACT</OptInSource>
      <ContactLists>';
foreach($idList as $list) {
        $postdata .= '
        <ContactList id="http://api.constantcontact.com/ws/customers/btrevena/lists/'.$list.'"></ContactList>'; }
$postdata .= '
      </ContactLists>
    </Contact>
  </content>
</entry>';

 It sends OptInSource as ACTION_BY_CONTACT, and a list of lists based on the form.

Anything look wrong here that I need to change, that might fix our issue?

Thanks

1 REPLY 1
Highlighted
Employee

Re: Opting back in a contact on Do Not Mail list doesn't work.

Hey,

 

What response code is being passed back?  Is it successful or is it return an error code?

Ryan Davis
Quality 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