Method: Mailchimp::Lists#unsubscribe

Defined in:
lib/mailchimp/api.rb

#unsubscribe(id, email, delete_member = false, send_goodbye = true, send_notify = true) ⇒ Hash

Unsubscribe the given email address from the list

Parameters:

  • id (String)

    the list id to connect to. Get by calling lists/list()

  • email (Hash)

    a struct with one of the following keys - failing to provide anything will produce an error relating to the email address. Providing multiples and will use the first we see in this same order.

    • String

      email an email address

    • String

      euid the unique id for an email address (not list related) - the email “id” returned from listMemberInfo, Webhooks, Campaigns, etc.

    • String

      leid the list email id (previously called web_id) for a list-member-info type call. this doesn’t change when the email address changes

  • delete_member (Boolean) (defaults to: false)

    flag to completely delete the member from your list instead of just unsubscribing, default to false

  • send_goodbye (Boolean) (defaults to: true)

    flag to send the goodbye email to the email address, defaults to true

  • send_notify (Boolean) (defaults to: true)

    flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true

Returns:

  • (Hash)

    with a single entry:

    • Bool

      complete whether the call worked. reallistically this will always be true as errors will be thrown otherwise.



1211
1212
1213
1214
# File 'lib/mailchimp/api.rb', line 1211

def unsubscribe(id, email, delete_member=false, send_goodbye=true, send_notify=true)
    _params = {:id => id, :email => email, :delete_member => delete_member, :send_goodbye => send_goodbye, :send_notify => send_notify}
    return @master.call 'lists/unsubscribe', _params
end