Revolvapp uses templates with simplified email syntax. This makes it easier and faster to create templates. But to send an email to someone through an email service or using your server's sending library, you need to get the generated HTML code for the email.
There are three ways to get generated HTML from the Revolvapp editor.
The first way is to get HTML with API:
<!-- call api -->
<button onclick="getHtml();">Get HTML</button>
<!-- element -->
<div id="myemail"></div>
<!-- init -->
<script>
Revolvapp('#myemail', {
editor: {
path: '/revolvapp-dist/',
template: '/my-folder/template.html'
}
});
</script>
<!-- get html functon -->
<script>
function getHtml() {
var app = Revolvapp('#myemail');
var html = app.editor.getHtml();
}
</script>
The second is to get HTML with the editor.change
event.
<!-- element -->
<div id="myemail"></div>
<!-- init -->
<script>
Revolvapp('#myemail', {
editor: {
path: '/revolvapp-dist/',
template: '/my-folder/template.html'
},
subscribe: {
'editor.change': function() {
var html = this.app.editor.getHtml();
}
}
});
</script>
The third way is autosave
option.
<!-- element -->
<div id="myemail"></div>
<!-- init -->
<script>
Revolvapp('#myemail', {
editor: {
path: '/revolvapp-dist/',
template: '/my-folder/template.html'
},
autosave: {
url: '/my-backend-script/'
}
});
</script>
Just set up the path to your backend script in the autosave
option and every time when changes occur in the editor, Revolvapp will be send the post request to your backend. Request has one param:
Here is the php example of how to get the param:
<?php
$html = $_POST['html'];