Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MailerLite PHP SDK Adding HTML Content #19

Open
codiller opened this issue Dec 13, 2023 · 0 comments
Open

MailerLite PHP SDK Adding HTML Content #19

codiller opened this issue Dec 13, 2023 · 0 comments

Comments

@codiller
Copy link

Summary

When creating a new campaign using the MailerLite PHP SDK, MailerLite is automatically adding code to the bottom of the HTML content even when the Unsubscribe tag is present in the 'content' parameter being passed to MailerLite API and the "Automatically generate a footer from the company details." is unchecked in the Account Settings. If you edit the HTML content in the MailerLite UX, the code disappears.

Expected Results

A campaign would be created containing only my HTML code that was in the 'content' parameter. In the below example, it is <p>Thanks for the email. <a href="{$unsubscribe}">Unsubscribe</a></p>.

Actual Results

The following code is inserted below the HTML code in the 'content' parameter.

<style type="text/css">
    .mlFooter p{margin:0}@media only screen and (max-width:640px){.mlContentTable{width:100%!important;min-width:10%!important;margin:0!important;float:none!important}.mlContentOuter{padding-bottom:0!important;padding-left:15px!important;padding-right:15px!important;padding-top:0!important}}
</style>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="680" style="width: 680px; min-width: 680px;" class="mlMainContent" dir="ltr">
    <tbody>
        <tr>
            <td class="mlTemplateContainer" style="padding: 20px 20px 0px 20px;">
                <table border="0" cellpadding="0" width="100%" class="mlMainContent" style="border-top: 1px solid #d1d3d3;">
                    <tbody>
                        <tr>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
<table role="article" aria-roledescription="email" align="center" border="0" cellpadding="0" cellspacing="0" width="680" style="width: 680px; min-width: 680px;" class="mlMainContent" dir="ltr">
    <tbody>
        <tr>
            <td class="mlTemplateContainer" style="padding: 20px 20px 0px 20px;">
                <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mlMainContent">
                    <tbody>
                        <tr>
                            <td style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 125%; color: #000000; padding-top: 15px;" class="ml-rte-footer" align="left">
                            </td>
                        </tr>
                        <tr>
                            <td id="mlRTEfooterUnsubscribe" style="line-height: 125%;" align="left">
                            </td>
                        </tr>
                        <tr>
                            <td height="20"></td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>

Steps to Reproduce

  1. Install MailerLite PHP SDK as shown here: https://github.com/mailerlite/mailerlite-php
  2. Create new php file in the project copying and pasting the example shown here: https://github.com/mailerlite/mailerlite-php#create-campaign
  3. Add any HTML into the 'content' parameter. I added: <p>Thanks for the email. <a href="{$unsubscribe}">Unsubscribe</a></p>
  4. From the command line, run your PHP file to create the campaign.
  5. The campaign should be created in your MailerLite account and, when you preview the created campaign, you should see the extra code inserted. Here's a preview of a campaign I created via the MailerLite PHP SDK: https://preview.mailerlite.io/preview/692096/emails/107481786535118262

For the above steps to reproduce, here's the entirety of my PHP file:

require 'vendor/autoload.php';

use MailerLite\MailerLite;

$mailerLite = new MailerLite(['api_key' => '{my API key went here}']);

$data = [
    'type' => 'regular',
    'name' => '{my campaign name went here}',
	'language_id' => 4,
    'emails' => [
        [
            'subject' => '{my subject went here}',
            'from_name' => '{my name went here}',
            'from' => '{my verified email address went here}',
            'content' => '<p>Thanks for the email. <a href="{$unsubscribe}">Unsubscribe</a></p>',
        ]
    ],
    'filter' => [],
];

$response = $mailerLite->campaigns->create($data);
@codiller codiller changed the title PHP SDK Adding MailerLite Footer MailerLite PHP SDK Adding HTML Content Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant