AcyMailing
Our siteForumBlog
Latest version
Latest version
  • AcyMailing documentation
  • How to renew AcyMailing license?
  • How to switch AcyMailing license plan?
  • Setup AcyMailing
    • Update from AcyMailing 5
    • Installation
      • Download AcyMailing
      • Install AcyMailing
      • Update AcyMailing
      • Switching from Starter to a paid version
      • Uninstall AcyMailing
    • Move AcyMailing between websites
      • Migrate between Joomla! and WordPress
      • Move between two WordPress websites
      • Switch from Joomla 3 to Joomla 4/5
    • Configuration
      • License
      • Mail settings
        • Set up your DKIM : DomainKeys Identified Mail
        • Set up Oauth 2.0
      • Queue process
      • Configure your send process
      • Subscription
      • Bounce handling
      • Data collection
      • Security
      • Languages
    • Step by step guide
    • Multilingual websites
      • Translate AcyMailing
      • Custom translation
    • Subscription to your lists
      • Subscription form - Joomla
      • Subscription form - WordPress
      • Other subscription methods
      • RSForm!Pro integration
  • External sending methods
    • AcyMailing Sending Service
    • Amazon SES
    • ElasticEmail
    • Mailgun
    • Postmark
    • SendGrid
    • Brevo SMTP Relay
    • Brevo / Sendinblue (Legacy)
  • Main pages
    • Dashboard
    • Subscription forms
      • Subscription Form
      • Header
      • Footer
      • Popup
      • Shortcode (Wordpress)
    • Subscribers
      • Create a subscriber
      • Import subscribers
      • Export subscribers
    • Custom fields
      • Create Custom Field
      • Examples
    • Lists
      • Create a list
    • Segment
      • Edition
    • Emails
      • Creation of a campaign
        • Choose a template
        • Edit email
        • Recipients
        • Segment
        • Send settings
        • Tests
        • Summary
      • A/B testing
      • Automatic campaigns
      • Follow-up
        • Trigger
        • Condition
        • Emails
        • Summary
      • Special mails
    • The email editor
      • Tenor integration
      • Unsplash integration
    • Templates
      • Create a template
      • Import a template
    • Email overrides
      • Edition
    • Automations
      • Information
      • Conditions
      • Actions
      • Action targets
      • Summary
    • Scenario
      • Create a new Scenario
      • Performances
    • Queue
    • Statistics
      • Overview
      • Detailed Statistics
      • Click map
      • Links details
      • User click details
      • Statistics per list
    • Add-ons
    • Mailbox actions
      • Mailbox actions
        • Edition
      • Bounce rules
        • Configuration
        • Listing
        • Create bounce rules
  • Advanced
    • Send follow-up messages based on subscription
    • Let site users use AcyMailing
      • List management
      • User management
      • Campaigns management
    • Show an archive of the sent newsletters
    • Show a profile edition form on your site
    • Partner platform
      • Log in
      • Dashboard
      • Single domain details
  • Integrations
    • Settings
    • Joomla add-ons
      • Joomla articles
      • CB Subscriptions
      • Community Builder
      • Community Quiz
      • Community Surveys
      • Contacts
      • Dashboard Quick icon
      • Docman
      • DPCalendar
      • EasyBlog
      • EasyProfile
      • EasySocial
      • Event Booking
      • FLEXIcontent
      • HikaShop
      • iCagenda
      • JCal Pro
      • jDownloads
      • JEvents
      • JSW CRM
      • JTicketing
      • K2 Content
      • Membership Pro
      • Module
      • PayPlans
      • Phoca Download
      • RSEvents!Pro
      • Seblod
      • Shika
      • VirtueMart
      • Zoo
    • WordPress add-ons
      • WordPress posts and pages
      • Advanced Custom Fields (ACF)
      • Business Directory
      • Contact Form 7
      • Easy Digital Downloads
      • EventON
      • Events Manager
      • Gravity Forms
      • Learndash
      • MemberPress
      • Modern Events Calendar
      • The events calendar
      • Ultimate Member
      • Uncanny Automator
      • WooCommerce
    • All websites add-ons
      • Articles, posts and pages from WordPress and Joomla
      • Automation - export action
      • Create user
      • Custom headers
      • RSS and Atom feeds
      • Table of contents generator
      • Universal filter
    • Zapier
  • Developers
    • Developer Documentation
    • Making a custom add-on
      • Execute custom script on specific AcyMailing actions
      • Insert a dynamic text in an email for Joomla
      • Insert a custom block in an email for Joomla
      • Insert a dynamic text in an email for WordPress
      • Insert a custom block in an email for WordPress
    • Custom script using our code
    • Create a page override
    • Joomla quickstart package with AcyMailing
    • Customise inserted content
  • FAQ
    • Could not instantiate mail function - AcyMailing
    • Spam issue
    • Your send process is slow?
    • Compatibility issues
    • Mail archive not displaying special characters
Powered by GitBook
On this page
  • Description
  • Integrate using PHP code
  • Let users choose their subscription
  • Use a Radio Group field as a Yes/No subscription field
  • Use a Checkbox field to choose the lists individually
  1. Setup AcyMailing
  2. Subscription to your lists

RSForm!Pro integration

PreviousOther subscription methodsNextAcyMailing Sending Service

Last updated 9 months ago

Description

If you use RSForm!Pro on your website, you can integrate AcyMailing with it so that when a user submits a form, this user is also subscribed to one or several AcyMailing Lists.

Integrate using PHP code

You can configure RSForm!Pro to execute a php script to subscribe the user in AcyMailing. First of all, edit your form and go in the PHP Scripts section:

The script should go in the Script called after form has been processed area to ensure the user isn't subscribed if an error occurs on the form:

You can use this script as a base, and modify it to meet your needs:

// Load the AcyMailing library
$postData = $_REQUEST['form'];
$ds = DIRECTORY_SEPARATOR;
include_once rtrim(JPATH_ADMINISTRATOR, $ds).$ds.'components'.$ds.'com_acym'.$ds.'helpers'.$ds.'helper.php';
$userClass = new AcyMailing\Classes\UserClass();

// Build the user based on your form's fields
$myUser = new stdClass(); 
$myUser->email = strip_tags($postData['EMAIL_FIELD']);
$myUser->name = strip_tags($postData['NAME_FIELD']);

// If the user already exists update it
$existingUser = $userClass->getOneByEmail($postData['EMAIL_FIELD']);
if (!empty($existingUser)) $myUser->id = $existingUser->id;

// You can add as many extra fields as you want if you already created them in AcyMailing
$customFields = [];
$customFields[CUSTOM_FIELD_ID] = $postData['MY_FIELD']; // the custom field id can be found in the Custom fields list of the AcyMailing admin page


$userClass->sendConf = true; // Or false if you don't want a confirmation email to be sent
$userId = $userClass->save($myUser, $customFields);


// The user now exists in AcyMailing, let's add some list subscriptions
$subscribe = [2,5,6]; // Ids of the lists you want the user to be subscribed to need to be added in this array
$userClass->subscribe($userId, $subscribe);

In this code, CUSTOM_FIELD_ID is the ID that can be seen in the Acy custom fields listing.

EMAIL_FIELD, NAME_FIELD and MY_FIELD must be replaced by your form's field names, so in this example it would be "Email", "the user name" and "Our newsletters field name":

Let users choose their subscription

You can add a Radio Group field or a Checkbox Group field to let users choose their subscription. Here are some examples:

Use a Radio Group field as a Yes/No subscription field

// The user now exists in AcyMailing, let's add some list subscriptions

if (!empty($postData['newsletters']) && $postData['newsletters'] === 'Yes') {
    $subscribe = [2,5,6]; // Ids of the lists you want the user to be subscribed to need to be added in this array
    $userClass->subscribe($userId, $subscribe);
}

Use a Checkbox field to choose the lists individually

// The user now exists in AcyMailing, let's add some list subscriptions

$subscribe = [];

if (!empty($postData['lists'])) {
    if (in_array('Monthly news', $postData['lists'])) $subscribe[] = 2; // 2 being the list ID corresponding to the monthly news
    if (in_array('Weekly news', $postData['lists'])) $subscribe[] = 5;
    if (in_array('Daily news', $postData['lists'])) $subscribe[] = 6;
    
    $userClass->subscribe($userId, $subscribe);
}