How do you export emails?

Hi,

is there a way to export the “source code” of the emails I created? I created some content for a long term nurturing sequence and would hate it, if that content got deleted by a malfunction/bug/etc. (Doesn’t have to be mautic related. A hack or user error could delete it, too.)

I guess that a database dump includes the emails, but I’d like to have a text file for every email.

Is that possible?

You can open the source code and copy + paste.

Is this a feature that will be add in the near future, since re-creating emails after every update (since we all know that update button doesn’t work) is become stressful. I know you guys do a lot, can there be a talk about this… ty.

Hi, the solution is rather to have smooth updates, no?

Hi @jason_nyc are you looking to create custom email or landing pages theme?

1 Like

Hi Peter

You can use the following bash script to download all html for each email:

(please install the tool jq before and set API USER, PWD and API )

#!/bin/bash
# stop script run when error occurs
#set -euox pipefail

MAUTIC_API_USER=""
MAUTIC_API_PWD=""
MAUTIC_API_BASEURL="https://m.dev.testserver.online/api/"

ACTION="emails"
RESULTS=$(curl -s -X GET -u $MAUTIC_API_USER:$MAUTIC_API_PWD "${MAUTIC_API_BASEURL}${ACTION}?minimal=1" |jq -c '.emails[].id')

for row in $RESULTS; do
    ID="$row"
    
    curl -s -X GET -u $MAUTIC_API_USER:$MAUTIC_API_PWD "${MAUTIC_API_BASEURL}${ACTION}/${ID}" |jq -r '.email.customHtml | @sh'  | tee "${ACTION}_${ID}.html"
done

It will download every email into a separate html file via the mautic api.

Greetings
Sebastian

1 Like