Goper Leo Zosa
Goper Leo Zosa

Reputation: 1283

Mailchimp verify subscriber email first

I use Laravel 5 to develop an app and I use Mailchimp for adding subscription. I use Mailchimp v.3 . I can make a list using this code:

               $mailchimp = new Mailchimp(xxxxxxxxxxxx-xx);
               $contact = [
                    'company' => $request['campaign'],
                    'address1' => $request['address'],
                    'city' => $request['city'],
                    'state' => $candidate->userCandidate->state,
                    'zip' => $request['zip'],
                    'country' => $request['country'],
                    'phone' => $request['phone'],
                ];

                $campaign_details = [
                    'from_name' => $request['from_name'],
                    'from_email' => $request['from_email'],
                    'subject' => $request['remind_text'],
                    'language' => 'English'
                ];

                $data = [
                    'name' => Auth::user()->name . ' Campaign',
                    'contact' => $contact,
                    'permission_reminder' => $request['remind_text'],
                    'campaign_defaults' => $campaign_details,
                    'notify_on_subscribe' => $request['from_email'],
                    'notify_on_unsubscribe' => $request['from_email'],
                    'email_type_option' => false,
                    'visibility' => $request['visibility'],

                ];

                $list = $mailchimp->post('lists', $data);

I use this library drewm/mailchimp. My code on subscribing is this:

$mailchimp = new Mailchimp($api_key);
  $subscriber = [
    'email_type' => 'html',
    'email_address' => $email,
    'language' => 'English',
    'status' => 'subscribed',
    'merge_fields' => ['zip' => $zip]
  ];

  $result = $mailchimp->post('lists/' . $list_id . '/members', $subscriber);

And I can successfully subscribe it. This is my question how to verify an email first before will be recorded on mailchimp list to avoid spammer. I read on mailchimp that they have DOUBLE OPT-IN method but it is only available if you use their form.

My solution is to email first on subscriber and create a link for verifying and this solution can take time. Is there another solution on this? Does Mailchimp have method to acquire this?

Upvotes: 1

Views: 2623

Answers (3)

Vlam
Vlam

Reputation: 1798

MailboxValidator does have an easy import feature to grab your list from MailChimp for email validation purposes. Then it automatically updates your MailChimp list once the validation process is done.

https://www.mailboxvalidator.com/resources/articles/how-to-import-email-list-from-mailchimp/

Upvotes: 0

TooMuchPete
TooMuchPete

Reputation: 4643

The quick answer to your question is to set the status to "pending" instead of "subscribed", but you should check out MailChimp's docs on managing subscribers with API v3 for more details.

Upvotes: 0

jhnferraris
jhnferraris

Reputation: 1401

I don't have any idea on Mailchimp API. However, you just have to set up an email validation flow first. In this way, all emails will not be considered as "spam" in your records. Then you're free to do any email tasks without worrying if it is valid or not.

Upvotes: 0

Related Questions