Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] Issue with API mail_send parameter but manual emails work

Simple Membership Plugin › Forums › Simple Membership Plugin › Issue with API mail_send parameter but manual emails work

Tagged: email

  • This topic has 3 replies, 3 voices, and was last updated 7 years, 1 month ago by admin.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • July 15, 2019 at 7:30 pm #18613
    Arbel
    Participant

    I am trying to integrate this plugin on our website to support login features. So far it has been mostly successful but we are having an issue with emails. In our PayPal IPN call we create the member with the API like so:

    $post_arr = array(			
    'swpm_api_action' => 'create',
    			'key' => '(key hidden)',
    			'user_name' => $email,
    			'first_name' => $first_name,
    			'last_name' => $last_name,
    			'email' => $email,
    			'street' => $address_1,
    			'city' => $city,
    			'state' => $state,
    			'zipcode' => $zipcode,
    			'country' => $country,
    			'company' => $business,
    			'phone' => $phone,
    			'membership_level' => $membershipLevel,
    			'send_mail' => 1
    		);

    This successfully adds the user as noted by when outputting the API response (omitted some values).

    (
        [result] => success
        [message] => Member created successfully
        [member] => Array
            (
                [first_name] => firstname
                [last_name] => lastname
                [user_name] => username
                [email] => email
                [phone] => # here
                [company_name] => 
                [country] => US
                [membership_level] => 4
                [account_state] => activation_required
                [reg_code] => code here
                [member_id] => id here
            )
    
    )

    However, it does not trigger an email. What might be causing this? I have read the post about emails not being sent out and I have done the following:

    1.) Enabled Debug option to see logging. We do not get any logging when making the API call.
    2.) Use an SMTP plugin. We have this setup and its working fine for WooCommerce and other plugins.
    3.) Use an email associated with the domain. We do this and its worked fine in every plugin.
    4.) Try manual password reset emails to see if its just the API. This does seem to work and is the only email that gets sent out with this plugin.
    5.) Ensure the from address is correct in the settings.

    Any ideas on what else it may be? Is my API request not correct? Does activation required not trigger an email regardless?

    Thanks,
    Matt

    July 16, 2019 at 3:10 pm #18614
    The Assurer
    Moderator

    Please refer to the file: classes/class.swpm-utils.php
    Scroll down to the definition of: SwpmUtils.get_registration_complete_prompt_link()
    Within the foreach loop…
    Notice the following conditional block…

    
        if ( $send_email && empty($member->user_name) ) {
            <snip>
            wp_mail($member->email, $subject, $email_body, $headers);
            <snip>
        }
    

    In other words… if user_name is already defined; no registration email will be sent, no matter what send_email is set to.

    July 16, 2019 at 5:48 pm #18616
    Arbel
    Participant

    Thank you for the clarification. I removed the username from the parameters but it still did not work. However, I decided to try using send_email instead of send_mail. That fixed it. I was going based off of this documentation:

    https://simple-membership-plugin.com/simple-membership-api-creating-member-account-using-http-post-request/

    It specifically states, “There is an additional parameter send_mail, which can be 1 or 0. If it’s 1, addon will send registration email to user upon successful user creation. If not – it won’t.”

    I think this should be updated to say send_email as well as clear up any confusion about passing a username. I was thinking you could force the username to be their email but still require activation to confirm said email. Thank you.

    July 18, 2019 at 8:40 am #18642
    admin
    Keymaster

    There was a typo in the documentation. I have just fixed it. Thank you for pointing it out.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy