Forum

Thread tagged as: Question, MailChimp

Email subscription does not work

Below is my form code

<span  style="display: inline-flex;">
<perch:form id="subscribe" app="perch_mailchimp" double-optin="true" send-welcome="true">
    <perch:success>
        <p style="color:white">Thank you!</p>
    </perch:success>

    <div>
        <perch:input id="email" class="email theme-default-input newsletter-input" required="true" type="email" mailer="email" placeholder="Enter Email Address" />
        <perch:error type="required" for="email">Required</perch:error>
        <button name="subscribe" id="mc-embedded-subscribe" type="submit" class="home-subscribe-button button tiny" style="background: transparent; margin-bottom: 0; padding: 0; "> </button>
    </div>
    <div  style="display:none">
        <perch:input type="submit" value="Submit" id="btnsubmit" />
        <perch:input type="hidden" value="1" id="confirm" mailer="confirm_subscribe" />
        <perch:input type="hidden" id="list" value="d8b7779c26" mailer="list" />
    </div>  

</perch:form>
</span>

I get thank you message, but don't get confirmation email. below is Diagnostic report

SUMMARY INFORMATION

Perch Runway: 2.8.29, PHP: 5.5.18, MySQL: 5.5.38, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), jw_activity_log (1.0.1), perch_blog (5.0), collection_2 (2.8.29), collection_8 (2.8.29), ketterus_dashboard (1), collection_3 (2.8.29), collection_6 (2.8.29), perch_forms (1.8.3), instagram (2.1), perch_shop_orders (1.0), perch_shop_products (1.0), my_sample (2.1), perch_shop (1.0), storelocator (2.1), perch_members (1.5), perch_mailchimp (3.0)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_shop', 'perch_mailchimp', 'perch_forms', 'perch_blog', 'instagram', 'jw_activity_log', 'storelocator', 'sherrihill', );
PERCH_LOGINPATH: /content
PERCH_PATH: /Users/sawan/Sites/Sherrihill.com/content
PERCH_CORE: /Users/sawan/Sites/Sherrihill.com/content/core
PERCH_RESFILEPATH: /Users/sawan/Sites/Sherrihill.com/content/resources
Image manipulation: GD
PHP limits: Max upload 1024M, Max POST 1024M, Memory: 128M, Total max file upload: 128M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: sherrihill.local
DOCUMENT_ROOT: /Users/sawan/Sites/Sherrihill.com
REQUEST_URI: /content/core/settings/diagnostics/
SCRIPT_NAME: /content/core/settings/diagnostics/index.php

it worked with old version, but does not work with new one.

sawan ruparel

sawan ruparel 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you see any API activity in your MailChimp account?

What happens if you turn on debug?

This is what I get in debug log

Array
(
    [headers] => Array
        (
            [url] => https://us8.api.mailchimp.com/3.0/lists/d8b7779c26/members
            [content_type] => application/problem+json; charset=utf-8
            [http_code] => 400
            [header_size] => 416
            [request_size] => 407
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0.174149
            [namelookup_time] => 0.004206
            [connect_time] => 0.005998
            [pretransfer_time] => 0.012482
            [size_upload] => 75
            [size_download] => 259
            [speed_download] => 1487
            [speed_upload] => 430
            [download_content_length] => 259
            [upload_content_length] => 75
            [starttransfer_time] => 0.174106
            [redirect_time] => 0
            [redirect_url] => 
            [primary_ip] => 23.202.213.92
            [certinfo] => Array
                (
                )

            [primary_port] => 443
            [local_ip] => 172.31.1.62
            [local_port] => 33680
            [request_header] => POST /3.0/lists/d8b7779c26/members HTTP/1.0
User-Agent: DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)
Host: us8.api.mailchimp.com
Accept-Encoding: deflate, gzip
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Authorization: apikey f82b39f30f1f385f06b901df66d55f7e-us8
Content-Length: 75


        )

    [body] => {"type":"https://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"","errors":[{"field":"merge_fields","message":"Schema describes object, array found instead"}]}
)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah ok, yes - we've fixed that so it should be in the next update.

so i should wait for next update right?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Or add a hidden field with some interests.

do I have to have interests ? earlier version didn't force me to have it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

The bug currently is that the code is expecting interests and so fails if none are set. There'll be an update to address this probably tomorrow.

update fixed it. thanks

Perfect. Many thanks.

One thing I notice over the course of trying to get this to work today was on the dashboard mailchimp was reporting that the last successful subscribe was on 6th September. I tested the stand alone subscribe form which is in the foot of everypage ofthe site and successfully subscribed several times. In the dashboarcthese successful subscribe were reported. However when I just logged in before making the above fix, I noticed that it had reverted back to showing the last subscribe as being on the 6th September? Very strange. I'll check again later tonight or in the morning and see if its still notifying me of the subscribe I've just done or yet again reverted back to the 6th Sept.