Jump to content

Access mailing list from offsite


Recommended Posts

In admin, Mailing List, Export Subscribers tab, an admin can download a text file (plain text or CSV) containing newsletter subscribers. This list can be integrated into another list for use by an external program.

On the Import Subscribers tab, a textbox exists to submit a list of email addresses to be added to CubeCart's newsletter subscriber list, if wanting to use CubeCart's feature of emailing a newsletter.

 

Link to comment
Share on other sites

 

Thanks for the reply, but it's not the answer I required.

I want to have access to people joining my cubecart mailing list, but accessing the submit box from offsite.

EG

If I wanted to access the mailing list join, from my own website it would be something like www.mysite/skins/template/box.mailing.php

But that dont work if accessing from a html page made on another site. So how do you put a html join up page on another site ?

Regards

 

Link to comment
Share on other sites

Unfortunately, CubeCart employs a one-off (nonce) "Security Token" that is unique for each POST payload to the storefront (which is coupled to a cookie-based 'session'). The programming code that processes the command to add an email address to CubeCart's Newsletter Subscriber database is looking only for POSTed key/values in the payload - not anything in the querystring.

Without a current security token, all GET and POST key/values are unset.

What needs to happen is to fetch any page from CubeCart. That page will have a form element of type=hidden containing the security token. Then, the form on the external site will submit a form:

Form:
action="www.mystore.com/?_a=newsletter"
method="post"

Payload:
[email protected]
token=hashcode_from_prior_page_load

Cubecart also employs an optional "double-opt-in" where an email is sent to the address submitted with a link to CubeCart to verify the subscription.

And CubeCart also employs an optional reCaptcha that must be solved prior to proceeding with certain functions - 'subscribing' is one of them.

Currently, there is no known after-market extension that would provide for CubeCart accepting subscription requests outside of itself.

Edited by bsmither
Link to comment
Share on other sites

Great answer thanks !

If the above is true, then it would be possible to send the user via url from one website to mywebsite, to a page that only had the signup submit, and then resize the page to display this, with something like......

('http://www.mysite.com/signup2',"My Window Name", "width=200,height=100")

If that would work, then any idea what the code would have to look like on the page within mysite to make that work ?

Regards

Link to comment
Share on other sites

What we can try to do is a code snippet with a 'cron' trigger. So, at your other site, a simple form with method "get" (passes a querystring) will be processed by the snippet - which can be as lax as you need it to be.

In admin, Manage Hooks, Code Snippets tab, click Add Snippet. Fill in the form that appears:

Enabled: checked
Unique ID: IngestSubscriberEmail@cc649+
Execution Order: 1
Description: Accepts and databases a subscriber's email address from outside CubeCart.
Trigger: cron
Version: 1.0.0
Author: https://forums.cubecart.com/topic/58293-access-mailing-list-from-offsite
Code:
<?php
  /**
   * Uses the 'cron' hook
   * Does not restrict based on 'double opt-in' settings.
   * Does not restrict based on 'reCaptcha' settings.
   */
    if (isset($_GET['email'] && filter_var($_GET['email'], FILTER_VALIDATE_EMAIL)) {
        $email = strtolower($_GET['email']);
        $GLOBALS['db']->delete('CubeCart_newsletter_subscriber', array('email' => $email));

        $record = array(
            'status'  => true,
            'email'   => $email,
            'customer_id'   => 0,
            'ip_address' => get_ip_address(),
            'date' => date('c'),
            'imported' => true
        );
        $GLOBALS['db']->insert('CubeCart_newsletter_subscriber', $record);
    }

The form to submit the data items:

Form attributes:
action="www.mystore.com"
method="get"

Form payload:
_g=cron
_m=runSnippets
[email protected]

Test thoroughly!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...