Add 2nd mail address

It will be great to have the option to add more than one email

1 Like

Hi there, @user3916 :wave:

Thanks for adding the idea to the Wishlist!

We agree that it would be cool to have this option in the settings. If more users upvote this request, we’ll try to think it over :slightly_smiling_face:

As for now, you can add the 2nd email using this code in the Custom JS section on the Style tab of your widget’s settings:

const SECOND_EMAIL = "test@test.com";
const EMAIL_SELECTOR = "[class*='content__Block-sc']:nth-child(4)";

const waitForElement = (selector, root = document) => new Promise(res => {
    let i = 0;

    const check = () => {
        const component = root.querySelector(selector);

        if (component) {
            res(component);
        } else if (i !== 150) {
            setTimeout(check, 100);
            i++;
        }
    };

    check();
});

waitForElement(EMAIL_SELECTOR).then((emailBlock) => {
  const emailBlockCopy = emailBlock.cloneNode(true);
  const anchor = emailBlockCopy.querySelector("a");
  anchor.href = `mailto:${SECOND_EMAIL}`;
  anchor.textContent = SECOND_EMAIL;
  
  emailBlock.insertAdjacentElement("afterend", emailBlockCopy);
});

In the 1st line of the code, you should add the needed email :slightly_smiling_face:

Note: Custom JS operates only upon widget installation, not in preview mode. Thus, the 2nd email will be displayed only on the page with the widget, but not in the editor.

2 Likes

perfect! everything works great, thank you!

1 Like

@user3916 Awesome, you are always welcome :wink:

How can I enter two email addresses?

1 Like

Hi there, @Romano_Studio :waving_hand:

Unfortunately, the widget’s settings don’t offer an option to set the 2nd email address. The request for this feature is already on the Wishlist and I’ve merged your comment with the thread, where we’ll keep you updated.

As for now, our devs suggested a custom solution. You can find it in the message above :wink: