### Mautic install command with parameters Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Example of running the installation command with specific parameters provided via the CLI. ```bash path/to/php bin/console mautic:install https://m.example.com --mailer_from_name="Example From Name" --mailer_from_email="mautic@localhost" --mailer_transport="smtp" --mailer_host="localhost" --mailer_port="1025" --db_driver="pdo_mysql" --db_host="db" --db_port="3306" --db_name="db" --db_user="db" --db_password="db" --db_backup_tables="false" --admin_email="admin@mautic.local" --admin_password="Maut1cR0cks!" ``` -------------------------------- ### Example local.php configuration Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html A sample local.php file used to define database and mailer settings for the installation. ```php 'localhost', 'db_table_prefix' => null, 'db_port' => 3306, 'db_name' => 'mautic', 'db_user' => 'mautic', 'db_password' => 'mautic', 'db_backup_tables' => false, 'db_backup_prefix' => 'bak_', 'admin_email' => 'admin@example.com', 'admin_password' => 'Maut1cR0cks!', 'mailer_transport' => null, 'mailer_host' => null, 'mailer_port' => null, 'mailer_user' => null, 'mailer_password' => null, 'mailer_api_key' => null, 'mailer_encryption' => null, 'mailer_auth_mode' => null, ); ``` -------------------------------- ### Initialize WordPress Development Environment Source: https://docs.mautic.org/en/7.1/plugins/wordpress.html Run these commands to install dependencies, build assets, and start the Docker-based WordPress environment. ```bash npm install npm run build:dev npm run env:start npm run env:install ``` -------------------------------- ### Full template configuration example Source: https://docs.mautic.org/en/7.1/builders/email_landing_page.html A complete example of a configuration file for a Mautic theme supporting multiple builders. ```json { "name": "Blank", "author": "Mautic team", "authorUrl": "https://mautic.org", "builder": ["legacy", "grapesjsbuilder"], "features": ["page", "email", "form"] } ``` -------------------------------- ### Mautic install command options Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html List of available flags and options for the mautic:install command. ```text --db_driver=DB_DRIVER Database driver. [default: "pdo_mysql"] --db_host=DB_HOST Database host. --db_port=DB_PORT Database port. --db_name=DB_NAME Database name. --db_user=DB_USER Database user. --db_password=DB_PASSWORD Database password. --db_table_prefix=DB_TABLE_PREFIX Database tables prefix. --db_backup_tables=DB_BACKUP_TABLES Backup database tables if they exist; otherwise drop them. [default: true] --db_backup_prefix=DB_BACKUP_PREFIX Database backup tables prefix. [default: "bak_"] --admin_firstname=ADMIN_FIRSTNAME Admin first name. --admin_lastname=ADMIN_LASTNAME Admin last name. --admin_username=ADMIN_USERNAME Admin username. --admin_email=ADMIN_EMAIL Admin email. --admin_password=ADMIN_PASSWORD Admin user. --mailer_from_name[=MAILER_FROM_NAME] From name for email sent from Mautic. --mailer_from_email[=MAILER_FROM_EMAIL] From email sent from Mautic. --mailer_transport[=MAILER_TRANSPORT] Mail transport. --mailer_host=MAILER_HOST SMTP host. --mailer_port=MAILER_PORT SMTP port. --mailer_user=MAILER_USER SMTP username. --mailer_password[=MAILER_PASSWORD] SMTP password. --mailer_encryption[=MAILER_ENCRYPTION] SMTP encryption (null|tls|ssl). --mailer_auth_mode[=MAILER_AUTH_MODE] SMTP auth mode (null|plain|login|cram-md5). --mailer_spool_type=MAILER_SPOOL_TYPE Spool mode (file|memory). --mailer_spool_path=MAILER_SPOOL_PATH Spool path. ``` -------------------------------- ### Date/Time Format Example Source: https://docs.mautic.org/en/7.1/contacts/import_contacts.html Example of the recommended ISO8601 date/time format for contact imports. ```text 2019-01-02 19:08:42 ``` -------------------------------- ### Install AMQP dependency Source: https://docs.mautic.org/en/7.1/configuration/settings.html Install the required Composer dependency for the AMQP transport. ```bash composer require symfony/amqp-messenger ``` -------------------------------- ### Certificate Directory Structure Example Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html Example of the expected directory structure for S/MIME certificates within the path defined by smime_certificates_path. ```text /var/smime_certificates/ ├── admin@example.com.crt ├── admin@example.com.pem ├── support@example.com.crt └── support@example.com.pem ``` -------------------------------- ### Install SendGrid Transport via Composer Source: https://docs.mautic.org/en/7.1/configuration/settings.html Command to install the official Symfony SendGrid transport plugin when Mautic is installed via Composer. ```bash composer require symfony/sendgrid-mailer ``` -------------------------------- ### Mautic installation output Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Sample output displayed during the Mautic installation process, including status checks and completion confirmation. ```text Mautic Install ============== Parsing options and arguments... 0 - Checking installation requirements... Missing optional settings: - [0] The memory_limit setting in your PHP configuration is lower than the suggested minimum limit of %min_memory_limit%. Mautic can have performance issues with large datasets without sufficient memory. Ready to Install! 1 - Creating database... 1.1 - Creating schema... 1.2 - Loading fixtures... 2 - Creating admin user... 3 - Email configuration and final steps... ================ Install complete ================ ``` -------------------------------- ### Configure RabbitMQ in local configuration Source: https://docs.mautic.org/en/7.1/queue/queue.html Example configuration parameters for connecting Mautic to a RabbitMQ server. ```php 'queue_protocol' => 'rabbitmq', 'rabbitmq_host' => 'b-180b97c2-6b05-4b10-80ed-09182eac3a02.mq.us-west-1.amazonaws.com', 'rabbitmq_port' => '5671', 'rabbitmq_vhost' => '/', 'rabbitmq_user' => 'some_user', 'rabbitmq_password' => 'some_password', 'rabbitmq_idle_timeout' => 0, 'rabbitmq_idle_timeout_exit_code' => 0, ``` -------------------------------- ### Start Mautic development environment with DDEV Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Initialize and start the DDEV environment within the Mautic directory to spin up services like Mailhog, PHPMyAdmin, and Redis Commander. ```bash ddev start ``` -------------------------------- ### Install Bitly bundle via Composer Source: https://docs.mautic.org/en/7.1/configuration/shortener.html Use this command to install the Bitly bundle for Mautic 5 via Composer. ```bash composer require webmecanik/mautic-bitly-bundle ``` -------------------------------- ### Install Mautic Sparkpost plugin Source: https://docs.mautic.org/en/7.1/configuration/settings.html Composer command to install the Mautic Sparkpost plugin for enhanced transport support. ```bash composer require ts-navghane/sparkpost-plugin ``` -------------------------------- ### Search Marketplace Plugins Source: https://docs.mautic.org/en/7.1/marketplace/marketplace.html Example command to filter the plugin list for a specific term, such as 'Captcha'. ```bash bin/console mautic:marketplace:list --filter=captcha ``` -------------------------------- ### Install Amazon SQS dependency Source: https://docs.mautic.org/en/7.1/configuration/settings.html Install the required Composer dependency for the Amazon SQS transport. ```bash composer require symfony/amazon-sqs-messenger ``` -------------------------------- ### Initialize new project without installation Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Run the create-project command with the --no-install flag to prepare a new Mautic project directory before modifying the folder structure. ```bash composer create-project mautic/recommended-project:^5 some-dir --no-interaction --no-install ``` -------------------------------- ### Staggered cron job schedule example Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html An example of how to stagger cron jobs to prevent them from running at the exact same minute. ```text - 0,15,30,45 <— mautic:segments:update - 5,20,35,50 <— mautic:campaigns:update - 10,25,40,55 <— mautic:campaigns:trigger ``` -------------------------------- ### Consume email queue Source: https://docs.mautic.org/en/7.1/configuration/settings.html Run this command to start consuming messages from the email queue. ```bash php bin/console messenger:consume email ``` -------------------------------- ### Install Beanstalkd dependency Source: https://docs.mautic.org/en/7.1/configuration/settings.html Install the required Composer dependency for the Beanstalkd transport. ```bash composer require symfony/beanstalkd-messenger ``` -------------------------------- ### Example Asset Download URL with UTM Parameters Source: https://docs.mautic.org/en/7.1/components/assets.html This URL structure demonstrates how to append UTM parameters to an asset download link to track source, medium, campaign, and other identifiers in reports. ```text /asset/{id}:{name}?utm_source=test&utm_medium=test&utm_campaign=test&utm_id=test&utm_term=test&utm_content=test ``` -------------------------------- ### Add dependencies with Composer Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Navigate to your project directory and use this command to add new dependencies, such as bundles, to your Mautic installation. ```bash cd your-directory composer require mautic/mautic/helloworld-bundle ``` -------------------------------- ### Example PHP warning for file access issues Source: https://docs.mautic.org/en/7.1/troubleshooting/file_ownership_permissions.html This warning indicates a failure to open a file, often caused by incorrect permissions or ownership on the Mautic instance. ```text .WARNING: PHP Warning - require(/mautic/var/cache/prod/doctrine/orm/Proxies/__CG__MauticCategoryBundleEntityCategory.php): failed to open stream: No such file or directory - in file /mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209 ``` -------------------------------- ### Change to Mautic directory Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Navigate to the directory where Mautic is installed before running update commands. ```bash cd /your/mautic/directory ``` -------------------------------- ### SendGrid API DSN configuration Source: https://docs.mautic.org/en/7.1/configuration/settings.html Example DSN string for configuring the SendGrid API transport in Mautic. ```text sendgrid+api://KEY@default ``` -------------------------------- ### Email recipient format example Source: https://docs.mautic.org/en/7.1/reports/reports.html Example of the comma-separated format required for specifying multiple email recipients for scheduled reports. ```text example1@example.com, example2@example.com ``` -------------------------------- ### Define custom countries in countries.json Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html Example format for defining custom countries in a JSON file located in the media/files directory. ```json [ "Middle Earth", "Fillory" ] ``` -------------------------------- ### Define custom regions in regions.json Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html Example format for mapping custom regions to countries in a JSON file located in the media/files directory. ```json { "Middle Earth": [ "The Shire", "Mordor" ], "Fillory": [ "Castle Whitespire", "Ember's Tomb" ] } ``` -------------------------------- ### Override PHP settings via .htaccess Source: https://docs.mautic.org/en/7.1/troubleshooting/working_with_resource_limits.html Example configuration to override global PHP settings locally within an .htaccess file. ```apache php_value upload_max_filesize 20M php_value max_execution_time 600 ``` -------------------------------- ### Rename docroot to public for existing installations Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Move the existing docroot directory to public before updating the composer.json configuration. ```bash mv docroot public ``` -------------------------------- ### Tracking Pixel PHP Embedding Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Example of generating a tracking pixel URL using PHP with encoded data. ```php $d = urlencode(base64_encode(serialize(array( 'page_url' => 'https://' . $_SERVER[HTTP_HOST] . $_SERVER['REQUEST_URI'], 'page_title' => $pageTitle, // Use your website's means of retrieving the title or manually insert it 'email' => $loggedInUsersEmail // Use your website's means of user management to retrieve the email )))); echo ''; ``` -------------------------------- ### Tracking Pixel JavaScript Embedding Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Example of dynamically injecting the tracking pixel into the DOM using JavaScript. ```javascript ``` -------------------------------- ### Submit Form via Tracking URL Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Example of a tracking URL used to submit a page view and email address to Mautic. ```text https://example.com/mtracking.gif?page_url=cart_screen&email=myemail@example.com ``` -------------------------------- ### Tracking Pixel HTML Embedding Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Example of embedding the tracking pixel directly into an HTML page with query parameters. ```html mautic is open source marketing automation ``` -------------------------------- ### Reload Mautic plugins Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html Command to reload plugins. You can also use mautic:plugins:install or mautic:plugins:update as aliases. ```bash php /path/to/mautic/bin/console mautic:plugins:reload ``` -------------------------------- ### Update Campaigns via CLI Source: https://docs.mautic.org/en/7.1/campaigns/creating_campaigns.html Use this command to add or remove contacts in batch for campaigns. Ensure you replace /path/to/mautic/ with your actual Mautic installation path. ```bash php /path/to/mautic/bin/console mautic:campaigns:update ``` -------------------------------- ### Boolean Field Label Modifier Example Source: https://docs.mautic.org/en/7.1/configuration/variables.html Demonstrates how the label modifier displays Yes or No instead of 1 or 0 for a boolean field. ```text {contactfield=is_subscriber} {contactfield=is_subscriber|label} ``` -------------------------------- ### iOS AppDelegate OneSignal integration Source: https://docs.mautic.org/en/7.1/channels/push_notifications.html Add this code to the application function of your AppDelegate to initialize OneSignal and sync user data with Mautic. The example uses Swift 3.1 and assumes a hardcoded email address for demonstration. ```swift // Somehow determine the user email. If you have user accounts, it may be better to move // this outside of the `application` func of `AppDelegate` in order to determine the user email. // In this example, the address is hardcoded for ease of use. let userEmail = "you@domain.com" OneSignal.initWithLaunchOptions(launchOptions, appId: "YOUR-ONE-SIGNAL-APP-ID") OneSignal.syncHashedEmail(userEmail); OneSignal.idsAvailable({(_ userId, _ pushToken) in let pushId = userId != nil ? userId : "" let pushEnabled = pushToken != nil ? true : false let userData = UserData(email: userEmail, push_id: pushId!, enabled: pushEnabled) self.pushUserDataToMautic(userData, "https://mautic.example.com/notification/appcallback") }); ``` -------------------------------- ### Select Field Label Modifier Example Source: https://docs.mautic.org/en/7.1/configuration/variables.html Demonstrates how the label modifier displays the human-readable label instead of the stored value for a select field. ```text {contactfield=country_select} {contactfield=country_select|label} ``` -------------------------------- ### pushUserDataToMautic function Source: https://docs.mautic.org/en/7.1/channels/push_notifications.html Use this function to send the UserData struct to your Mautic installation via a POST request. It includes logic to display the Mautic response as an app alert. ```swift func pushUserDataToMautic(_ userData: UserData, _ url: String) { var request = URLRequest(url: URL(string: url)!) request.httpMethod = "POST" let postString = UserData.toJSON(userData) request.httpBody = postString.data(using: .utf8) let task = URLSession.shared.dataTask(with: request) { data, response, error in guard let data = data, error == nil else { // check for fundamental networking error return } if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200 { // check for http errors return } // Comment the next 4 lines to remove the alert let responseString = String(data: data, encoding: .utf8) let alert = UIAlertController(title: "Response Data", message: responseString, preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) self.window?.rootViewController?.present(alert, animated: true, completion: nil); } task.resume() } ``` -------------------------------- ### Create Mautic project with Composer Source: https://docs.mautic.org/en/7.1/getting_started/switching_composer.html Run this command in the /var/www directory to initialize a new Mautic project using Composer. ```bash composer create-project mautic/recommended-project:^5 html-new --no-interaction ``` -------------------------------- ### List Marketplace Plugins Source: https://docs.mautic.org/en/7.1/marketplace/marketplace.html Executes the command to list the first page of available plugins in the Mautic Marketplace. ```bash bin/console mautic:marketplace:list ``` ```text +-------------------------------------------------------+-----------+--------+ | name | downloads | favers | +----------------------------------------------------+--------+-----+ | mautic/mautic-saelos-bundle | 11623 | 11 | | koco/mautic-recaptcha-bundle | 2662 | 24 | | This plugin brings reCAPTCHA integration to | | | | mautic. | | | | thedmsgroup/mautic-extended-field-bundle | 3069 | 25 | | Extends custom fields for scalability and | | | | HIPAA/PCI compliance. | | | | mtcextendee/mautic-sql-conditions-bundle | 190 | 6 | | maatoo/mautic-referrals-bundle | 1063 | 5 | | This plugin enables referrals in mautic. | | | | thedmsgroup/mautic-health-bundle | 2139 | 11 | | Checks the health of the Mautic instance. | | | | thedmsgroup/mautic-dashboard-warm-bundle | 1921 | 12 | | Improves the performance of the dashboard by | | | | sharing/extending/warming caches. | | | | thedmsgroup/mautic-contact-source-bundle | 2852 | 43 | | Creates API endpoints for receiving contacts from | | | | external sources. | | | | thedmsgroup/mautic-contact-client-bundle | 4035 | 70 | | Create custom integrations without writing code. | | | | thedmsgroup/mautic-campaign-watch-bundle | 1817 | 14 | | Visual improvements for campaigns. | | | | raow/mautic-rss-to-email-bundle | 971 | 69 | | mtcextendee/mautic-random-smtp-bundle | 101 | 10 | | kuzmany/mautic-recommender-bundle | 250 | 30 | | kuzmany/mautic-custom-tags-bundle | 119 | 20 | | dazzle/mautic-sendinblue-bundle | 73 | 5 | | Allows to send E-mails with Sendinblue | | | +-------------------------------------------------------+-----------+--------+ Total packages: 69 Execution time: 388 ms ``` -------------------------------- ### Marketplace List Help Options Source: https://docs.mautic.org/en/7.1/marketplace/marketplace.html Displays the available options for filtering and pagination when using the list command. ```bash -p, --page[=PAGE] Page number [default: 1] -l, --limit[=LIMIT] Packages per page [default: 15] -f, --filter[=FILTER] Filter the packages [default: ""] -h, --help Display this help message ``` -------------------------------- ### Company Field Label Modifier Examples Source: https://docs.mautic.org/en/7.1/configuration/variables.html Examples of using the label modifier for company select and boolean fields. ```text {contactfield=company_type|label} {contactfield=company_active|label} ``` -------------------------------- ### List available CLI commands Source: https://docs.mautic.org/en/7.1/configuration/command_line_interface.html Run this command to view the list of available CLI commands, including those related to Doctrine and other vendors. ```bash bin/console ``` -------------------------------- ### Check and run database migrations Source: https://docs.mautic.org/en/7.1/troubleshooting/troubleshooting.html Identify and execute outstanding database migrations. Ensure a database backup exists before running the migration command. ```bash php bin/console doctrine:migration:status ``` ```bash php bin/console doctrine:migration:migrate ``` -------------------------------- ### Generate self-signed S/MIME certificates with OpenSSL Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html Use these OpenSSL commands to create a private key and a self-signed certificate for testing. Replace sender@example.com with your actual sending email address. ```bash # Create a private key and certificate signing request openssl req -newkey rsa:4096 -nodes -keyout sender@example.com.pem -out sender@example.com.csr # Create a self-signed certificate valid for 1 year openssl x509 -req -days 365 -in sender@example.com.csr -signkey sender@example.com.pem -out sender@example.com.crt ``` -------------------------------- ### Fetch contacts from integration Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html Commands to synchronize contacts from external integrations. ```bash php /path/to/mautic/bin/console mautic:integration:fetchleads ``` ```bash php /path/to/mautic/bin/console mautic:integration:synccontacts ``` -------------------------------- ### Enable S/MIME in app/config/local.php Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html Add these parameters to your local.php file to enable S/MIME signing. Ensure you are using the SMTP transport, as this feature is incompatible with API-based transports. ```php true, 'smime_certificates_path' => '%kernel.project_dir%/var/smime_certificates', ); ``` -------------------------------- ### Navigate to WordPress Directory Source: https://docs.mautic.org/en/7.1/plugins/wordpress.html Change your working directory to the newly cloned WordPress development folder. ```bash cd wordpress-develop ``` -------------------------------- ### Import Campaign via CLI Source: https://docs.mautic.org/en/7.1/campaigns/importing_campaigns.html Use the mautic:entity:import command to import a campaign ZIP file from the command line. ```bash bin/console mautic:entity:import \ --entity=campaign \ --file=/tmp/entity_data.zip \ --user= ``` -------------------------------- ### GET /api/campaigns/export/{id} Source: https://docs.mautic.org/en/7.1/campaigns/exporting_campaigns.html Exports a specific campaign by its ID. The request requires authentication via a Bearer token. ```APIDOC ## GET /api/campaigns/export/{id} ### Description Exports a specific Campaign by ID. The API returns the campaign data and its dependencies. ### Method GET ### Endpoint https://example.com/api/campaigns/export/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the Campaign to export. ### Request Example curl --location 'https://example.com/api/campaigns/export/1' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' ### Response #### Success Response (200) - **content** (binary) - The exported campaign file (typically a ZIP archive). ``` -------------------------------- ### Find and apply updates via CLI Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Commands to check for available updates and apply them to the Mautic instance. ```bash php bin/console mautic:update:find ``` ```bash php bin/console mautic:update:apply ``` ```bash php bin/console mautic:update:apply --finish ``` -------------------------------- ### Create custom field column command Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html Run this command to create the database column and publish the field metadata after defining a custom field with background processing enabled. ```bash bin/console mautic:custom-field:create-column ``` -------------------------------- ### Theme package file structure Source: https://docs.mautic.org/en/7.1/builders/creating_themes.html Displays the required directory layout for a Mautic theme, including assets, html templates, configuration, and a thumbnail. ```text name.zip ├── assets │ ├── image1.ext │ └── image2.ext ├── html │ ├── email.html.twig │ ├── email.mjml.twig │ ├── base.html.twig │ └── message.html.twig ├── config.json └── thumbnail.png ``` -------------------------------- ### Override translation string in messages.ini Source: https://docs.mautic.org/en/7.1/translations/translations.html Example of overriding the 'Dashboard' menu item by defining the translation key in the custom overrides file. ```ini mautic.dashboard.menu.index="Banana" ``` -------------------------------- ### Set Certificate Permissions Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html Commands to configure ownership and restrictive permissions for certificate files and directories. Private keys must be set to 600 to prevent unauthorized access. ```bash # Set ownership (replace www-data with your web server user) chown -R www-data:www-data /path/to/mautic/var/smime_certificates # Set directory permissions chmod 755 /path/to/mautic/var/smime_certificates # Set certificate permissions chmod 644 /path/to/mautic/var/smime_certificates/*.crt chmod 600 /path/to/mautic/var/smime_certificates/*.pem ``` -------------------------------- ### Clone Mautic repository using GitHub CLI Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Use the GitHub CLI to clone your personal fork of the Mautic repository to your local machine. ```bash gh repo clone username/mautic ``` -------------------------------- ### Run update commands as web server user Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Commands to find, apply, and finish updates, and clear the cache while running as the web server user (e.g., www-data) to maintain correct file permissions. ```bash sudo -u www-data php bin/console mautic:update:find ``` ```bash sudo -u www-data php bin/console mautic:update:apply ``` ```bash sudo -u www-data php bin/console mautic:update:apply --finish ``` ```bash sudo -u www-data php /var/www/html/mautic/bin/console cache:clear ``` -------------------------------- ### Export Campaign via cURL Source: https://docs.mautic.org/en/7.1/campaigns/exporting_campaigns.html Perform a GET request to the Mautic API to export a campaign by its ID, using a Bearer token for authentication. ```bash curl --location 'https://example.com/api/campaigns/export/1' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` -------------------------------- ### Specify integration for synchronization Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html Use the --integration flag to target a specific plugin, such as HubSpot, to avoid performance issues. ```bash php /path/to/mautic/bin/console mautic:integration:fetchleads --integration=Hubspot php /path/to/mautic/bin/console mautic:integration:pushactivity --integration=Hubspot ``` -------------------------------- ### Configure template for multiple builders Source: https://docs.mautic.org/en/7.1/builders/email_landing_page.html Use this syntax to support both the legacy and GrapesJS builders in a single theme. ```json "builder": ["legacy", "grapesjsbuilder"], ``` -------------------------------- ### Run background import command Source: https://docs.mautic.org/en/7.1/contacts/import_contacts.html Execute the Mautic import command via CLI. The output displays the progress and summary of processed, created, updated, and ignored items. ```bash $ bin/console mautic:import 48/48 [============================] 100% 48 lines were processed, 0 items created, 48 items updated, 0 items ignored in 4.78 s ``` -------------------------------- ### Validate and restart Apache Source: https://docs.mautic.org/en/7.1/troubleshooting/working_with_resource_limits.html Commands to verify Apache configuration syntax and restart the service on different Linux distributions. ```bash sudo apachectl configtest ``` ```bash sudo systemctl restart apache2 ``` ```bash sudo systemctl restart httpd ``` -------------------------------- ### Mautic JavaScript Tracking Script Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html The primary JavaScript tracking method for Mautic. Insert this code before the closing tag of your website, ensuring you replace the example URL with your Mautic instance URL. ```javascript ``` -------------------------------- ### Track Contact Activity via JavaScript Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Sample method call to track specific screen activity for a contact. ```javascript mautic.track("cart_screen", "myemail@example.com") ``` -------------------------------- ### Push contact activity to integration Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html Commands to push contact activity data to external integrations. ```bash php /path/to/mautic/bin/console mautic:integration:pushactivity ``` ```bash php /path/to/mautic/bin/console mautic:integration:pushleadactivity ``` -------------------------------- ### List File Permissions and Ownership Source: https://docs.mautic.org/en/7.1/troubleshooting/file_ownership_permissions.html Use the ls command with the -l flag to display file and directory permissions, user, and group ownership in long format. ```bash ls -l ``` -------------------------------- ### Import Campaign via cURL Source: https://docs.mautic.org/en/7.1/campaigns/importing_campaigns.html Use a POST request with multipart/form-data to import a campaign ZIP file via the API. ```bash curl -X POST 'https://example.com/api/campaigns/import' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: multipart/form-data' \ -F 'file=@/path/to/campaign_export.zip' ``` -------------------------------- ### Import Campaign via Python Source: https://docs.mautic.org/en/7.1/campaigns/importing_campaigns.html Use the requests library to send a JSON-formatted campaign export to the Mautic API. ```python import requests import json # API Endpoint url = 'https://example.com/api/campaigns/import' # Authentication headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } # Body must be the full campaign export structure (same as entity_data.json) with open('entity_data.json') as f: payload = json.load(f) } # Send import request response = requests.post(url, headers=headers, json=payload) # Handle response if response.status_code == 201: print("Campaign imported successfully") ``` -------------------------------- ### Clone WordPress Development Repository Source: https://docs.mautic.org/en/7.1/plugins/wordpress.html Clone the official WordPress development repository to begin setting up your local environment. ```bash git clone https://github.com/WordPress/wordpress-develop.git ``` -------------------------------- ### Configure theme compatibility in config.json Source: https://docs.mautic.org/en/7.1/builders/creating_themes.html Defines the theme metadata and specifies the compatible builder as grapesjsbuilder. ```json { "name": "Great Theme", "author": "Mr. Robot", "authorUrl": "https://mautic.org", "builder": "grapesjsbuilder", "features": [ "email" ] } ``` -------------------------------- ### Locate php.ini via CLI Source: https://docs.mautic.org/en/7.1/troubleshooting/working_with_resource_limits.html Commands to find the active php.ini file path and specific configuration values when Mautic is inaccessible. ```bash php -i | grep .ini ``` ```bash php -i | grep upload_max_filesize ``` -------------------------------- ### Enable Email Drafts in local.php Source: https://docs.mautic.org/en/7.1/channels/emails.html Add this configuration parameter to your local.php file to enable the 'Save as Draft' functionality in the email editor. ```php 'email_draft_enabled' => 1 ``` -------------------------------- ### Update Mautic Database and Cache Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Run these commands after updating core files to clear the cache, apply updates, and execute database migrations. ```bash bin/console cache:clear bin/console mautic:update:apply --finish bin/console doctrine:migration:migrate --no-interaction bin/console cache:clear ``` -------------------------------- ### Encrypt Private Key via PHP Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html Use this PHP command-line snippet to encrypt a plain text private key using Mautic's encryption helper. Ensure the secret_key is configured in app/config/local.php before running. ```php php -r " require 'app/config/local.php'; require 'app/bundles/CoreBundle/Helper/EncryptionHelper.php'; $helper = new \Mautic\CoreBundle\Helper\EncryptionHelper( new \Mautic\CoreBundle\Helper\CoreParametersHelper(new \Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($parameters)) ); $key = file_get_contents('var/smime_certificates/sender@example.com.pem'); file_put_contents('var/smime_certificates/sender@example.com.pem.enc', $helper->encrypt($key)); " ``` -------------------------------- ### Reset File and Folder Permissions Source: https://docs.mautic.org/en/7.1/troubleshooting/file_ownership_permissions.html Commands to set standard permissions for files (644) and directories (755), grant group write access to specific directories, and clear the cache. ```bash find . -type f -not -perm 644 -exec chmod 644 {} + find . -type d -not -perm 755 -exec chmod 755 {} + chmod -R g+w var/cache/ var/logs/ app/config/ chmod -R g+w media/files/ media/images/ translations/ rm -rf var/cache/* ``` -------------------------------- ### Enable Landing Page drafts in local.php Source: https://docs.mautic.org/en/7.1/components/landing_pages.html Add the page_draft_enabled parameter to your local.php configuration file to enable the 'Save as Draft' functionality in the Landing Page editor. ```php 'page_draft_enabled' => 1 ``` -------------------------------- ### Identify PHP configuration errors Source: https://docs.mautic.org/en/7.1/troubleshooting/working_with_resource_limits.html Common error messages encountered when server resource limits are exceeded. ```text The Uploaded file exceeds the upload_max_filesize directive Maximum execution time of 30 seconds exceeded - in file - at line PHP Error: Allowed memory size of bytes exhausted (tried to allocate bytes) - in file - at line ``` -------------------------------- ### Configure template for GrapesJS builder Source: https://docs.mautic.org/en/7.1/builders/email_landing_page.html Add this line to your template configuration file to enable the GrapesJS builder. ```json "builder": ["grapesjsbuilder"], ``` -------------------------------- ### Analyze custom fields command Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html Use this command to analyze custom fields and optimize VARCHAR column sizes. The -t argument displays the output in a table format. ```bash bin/console mautic:fields:analyse -t ``` -------------------------------- ### Execute Mautic CLI command Source: https://docs.mautic.org/en/7.1/configuration/command_line_interface.html All Mautic commands must be prefixed with bin/console to execute correctly. ```bash bin/console mautic:segments:update ``` -------------------------------- ### Configure custom fonts in local.php Source: https://docs.mautic.org/en/7.1/builders/email_landing_page.html Define additional fonts by adding them to the 'editor_fonts' array in the app/config/local.php file. Each entry requires a unique name, font family definition, and a valid CSS style URL. ```php array( '0' => array( 'name' => 'Smokum', 'font' => 'Smokum, cursive', 'url' => 'https://fonts.googleapis.com/css2?family=Smokum&display=swap' ), '1' => array( 'name' => 'Sofia', 'font' => 'Sofia, sans-serif', 'url' => 'https://fonts.googleapis.com/css?family=Sofia' ) ), ``` -------------------------------- ### Set file permissions Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Sets file permissions to 644 for all files in the Mautic folder. ```bash sudo find /var/www/html/mautic -type f -exec chmod 644 {} + ``` -------------------------------- ### Set directory permissions Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Sets directory permissions to 755 for all directories in the Mautic folder. ```bash sudo find /var/www/html/mautic -type d -exec chmod 755 {} + ``` -------------------------------- ### Configure background custom field creation in local.php Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html Add this configuration to your app/config/local.php file to enable background processing for custom field creation, preventing HTTP request timeouts. ```php 'create_custom_field_in_background' => true ``` -------------------------------- ### Process Email Queue via Cron Source: https://docs.mautic.org/en/7.1/configuration/settings.html Command to process the email queue in Mautic. This should be set up as a Cron job at the desired interval. ```bash php /path/to/mautic/bin/console messenger:consume email ``` -------------------------------- ### Set owner to Apache Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Sets the owner of the Mautic directory to the Apache server user. ```bash sudo chown -R www-data:www-data /var/www/html/mautic ``` -------------------------------- ### Process queue hits via console Source: https://docs.mautic.org/en/7.1/queue/queue.html Commands to process page hits or email opens from the queue. ```bash php /path/to/mautic/bin/console mautic:queue:process --env=prod -i page_hit ``` ```bash php /path/to/mautic/bin/console mautic:queue:process --env=prod -i email_hit ``` -------------------------------- ### Trigger manual update Source: https://docs.mautic.org/en/7.1/troubleshooting/troubleshooting.html Check for available updates and apply them manually via the console. ```bash php bin/console mautic:update:find ``` ```bash php bin/console mautic:update:apply ``` -------------------------------- ### Cron job for pushing jobs Source: https://docs.mautic.org/en/7.1/queue/queue.html Command to run as a cron job to keep pushing email jobs. ```bash php /path/to/mautic/bin/console mautic:email:send ``` -------------------------------- ### Configure HubSpot cron job Source: https://docs.mautic.org/en/7.1/plugins/hubspot.html The command to fetch leads from HubSpot into Mautic via a cron job. ```bash php $PATH_TO_MAUTIC_DIRECTORY/bin/console mautic:integration:fetchleads --integration=Hubspot --fetch-all ``` -------------------------------- ### Export Campaign to ZIP via CLI Source: https://docs.mautic.org/en/7.1/campaigns/exporting_campaigns.html Use the mautic:entity:export command to save a campaign and its dependencies as a ZIP file in a specified directory. ```bash bin/console mautic:entity:export --entity=campaign --id=1 --zip-file --path=path/to-file ``` -------------------------------- ### Identify Apache User Source: https://docs.mautic.org/en/7.1/troubleshooting/file_ownership_permissions.html Find the user account running the Apache web server process. ```bash ps aux | grep apache2 ``` -------------------------------- ### Contact Field Variables List Source: https://docs.mautic.org/en/7.1/configuration/variables.html A reference table of common contact field variables and their corresponding syntax. ```text {contactfield=attribution} {contactfield=attribution_date} {contactfield=address1} {contactfield=address2} {contactfield=country} {contactfield=city} {contactfield=company} {contactfield=id} {contactfield=email} {contactfield=facebook} {contactfield=fax} {contactfield=firstname} {contactfield=foursquare} {contactfield=googleplus} {contactfield=instagram} {contactfield=ipAddress} {contactfield=lastname} {contactfield=linkedin} {contactfield=mobile} {contactfield=phone} {contactfield=position} {contactfield=skype} {contactfield=state} {contactfield=twitter} {contactfield=title} {contactfield=website} {contactfield=zipcode} ``` -------------------------------- ### Default Allowed File Types Source: https://docs.mautic.org/en/7.1/components/assets.html The list of file extensions permitted for upload by default in Mautic. ```text csv,doc,docx,epub,gif,jpg,jpeg,mpg,mpeg,mp3,odt,odp,ods,pdf,png,ppt,pptx,tif,tiff,txt,xls,xlsx,wav ``` -------------------------------- ### Add Contact via JavaScript Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Sample method call to POST a new contact to a Mautic form with ID 3. ```javascript mautic.addContact("myemail@example.com",3) ``` -------------------------------- ### Identify User Groups Source: https://docs.mautic.org/en/7.1/troubleshooting/file_ownership_permissions.html List the groups associated with the identified Apache user. ```bash groups apache_user - where apache_user is the user you identified from the first step above ``` -------------------------------- ### Set write permissions for specific directories Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html Grants write permissions to the Apache user for specific directories required for system tasks. ```bash sudo chmod -R g+w /var/www/html/mautic/var/cache \ /var/www/html/mautic/var/logs \ /var/www/html/mautic/app/config \ /var/www/html/mautic/media/files \ /var/www/html/mautic/media/images \ /var/www/html/mautic/translations ``` -------------------------------- ### Send scheduled reports command Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html Use this command to trigger the sending of scheduled reports. ```bash php /path/to/mautic/bin/console mautic:reports:scheduler [--report=ID] ``` -------------------------------- ### MaxMind CCPA Compliance Cron Jobs Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html Downloads the 'Do Not Sell' IP list and purges related data. It is recommended to run these commands weekly in sequence. ```bash php /path/to/mautic/bin/console mautic:donotsell:download ``` ```bash php /path/to/mautic/bin/console mautic:max-mind:purge ``` -------------------------------- ### POST /api/campaigns/import Source: https://docs.mautic.org/en/7.1/campaigns/importing_campaigns.html Imports a campaign into Mautic. Supports either a ZIP file via multipart/form-data or a JSON object representing the campaign structure. ```APIDOC ## POST /api/campaigns/import ### Description Imports a campaign into the Mautic instance. This endpoint supports importing via a ZIP file (multipart/form-data) or by sending the campaign structure directly as a JSON object. ### Method POST ### Endpoint https://example.com/api/campaigns/import ### Request Body - **file** (binary) - Optional - The campaign export ZIP file (use with multipart/form-data). - **JSON Payload** (object) - Optional - The full campaign export structure (use with application/json). ### Request Example (ZIP) curl -X POST 'https://example.com/api/campaigns/import' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: multipart/form-data' \ -F 'file=@/path/to/campaign_export.zip' ### Response #### Success Response (201) - The campaign is imported successfully. ``` -------------------------------- ### Change File and Folder Ownership Source: https://docs.mautic.org/en/7.1/troubleshooting/file_ownership_permissions.html Recursively update the owner and group for the Mautic directory using the chown command. ```bash sudo chown -R apache_user:apache_group /path/to/mautic ``` -------------------------------- ### Specify PHP version in composer.json Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html Pin the PHP version for your project by adding a platform configuration to the config section of composer.json. ```json "config": { "sort-packages": true, "platform": { "php": "7.4" } }, ``` -------------------------------- ### Tracking Custom Parameters Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Attach custom parameters like email and firstname to the pageview action to send additional data to Mautic. ```javascript mt('send', 'pageview', {email: 'my@email.com', firstname: 'John'}); ``` -------------------------------- ### Insert unsubscribe and preference center links Source: https://docs.mautic.org/en/7.1/channels/emails.html Use the {unsubscribe_url} and {dnc_url} tokens to create custom unsubscribe or preference management links within your email body. ```html Manage your email preferences Unsubscribe from all emails ``` -------------------------------- ### Export Campaign via Python Source: https://docs.mautic.org/en/7.1/campaigns/exporting_campaigns.html Use the requests library to programmatically export a campaign from Mautic via the API. ```python import requests # API Endpoint campaign_id = 1 url = f'https://example.com/api/campaigns/export/{campaign_id}' # Authentication headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } # Send export request response = requests.get(url, headers=headers) # Handle response if response.status_code == 200: export_file = response.content # Save or process the exported campaign ``` -------------------------------- ### Fetch Email Replies Cron Command Source: https://docs.mautic.org/en/7.1/channels/emails.html Run this command to fetch and process incoming contact replies from the configured IMAP inbox. ```bash php path/to/mautic/bin/console mautic:email:fetch ``` -------------------------------- ### mt('send', 'pageview', [data], [options]) Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html Sends a pageview event to Mautic with optional custom contact data and event callbacks. ```APIDOC ## mt('send', 'pageview', [data], [options]) ### Description Sends a pageview tracking event to the Mautic instance. This method automatically captures page metadata and allows for the inclusion of custom contact and company fields. ### Parameters - **data** (object) - Optional - An object containing key-value pairs for contact fields (e.g., email, firstname), company fields (e.g., company, companyemail), tags, or UTM codes. - **options** (object) - Optional - An object containing callback functions for tracking request lifecycle. ### Options - **onload** (function) - Callback executed when the tracking request successfully loads. - **onerror** (function) - Callback executed if the tracking request fails. ### Example ```javascript mt('send', 'pageview', { email: 'my@example.com', firstname: 'John', company: 'Mautic', tags: 'addThisTag,-removeThisTag' }, { onload: function() { alert("Tracking request is loaded"); } }); ``` ``` -------------------------------- ### Update MaxMind GeoLite2 IP Database Cron Job Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html Automatically downloads the MaxMind GeoLite2 IP database. ```bash php /path/to/mautic/bin/console mautic:iplookup:download ``` -------------------------------- ### Edit php.ini file Source: https://docs.mautic.org/en/7.1/troubleshooting/working_with_resource_limits.html Command to open the php.ini file for editing using the Nano text editor. ```bash sudo nano path/to/file/php.ini ``` -------------------------------- ### Trigger Campaign Events via CLI Source: https://docs.mautic.org/en/7.1/campaigns/campaign_builder.html Executes Mautic campaign actions and decisions. Requires a cron job to run at desired intervals. ```bash php /path/to/mautic/bin/console mautic:campaigns:trigger ``` -------------------------------- ### Joomla Dynamic Content Plugin Source: https://docs.mautic.org/en/7.1/components/dynamic_web_content.html Embed dynamic content in Joomla using the mautic shortcode syntax. ```text {mautic type="content" slot="slotname"} Insert default content {/mautic} ``` -------------------------------- ### Joomla! Shortcode Source: https://docs.mautic.org/en/7.1/components/forms.html Embed a form in Joomla! using the mauticform shortcode. ```text {mauticform ID#} ```