DataTable via email

0

I would like to know if there is any method to send a table formed with datatable through mail, the ideal is that when you press a button a pop-up window opens where you can enter the destination's email address and you should attach the table for example in pdf format automatically ... the pop-up window and the mailing have already been achieved using phpmailer and the following code

html

<button class="btn botonF5 mdl-button--primary mdl-button--raised dialog-button">
     <i class="material-icons">&#xE158;</i>                              
</button>
<dialog id="dialog" class="mdl-dialog" style="margin: auto; background: #3abac9;">
    <form id="formulario" method="post" action="php/enviar.php" enctype="multipart/form-data">
        <div class="mdl-textfield mdl-js-textfield" style="padding: 22px 0;">
            <input class="mdl-textfield__input" type="text" 
                   placeholder="Para" required
                   id="destino" name="destino" pattern="[A-Za-z0-9_-]{1,20}">
            <label style="visibility: visible "class="mdl-textfield__label" for="Usuario"><i class="material-icons">contact_mail</i></label>
            <label style="visibility: visible; text-align: right;" class="mdl-textfield__label"><div id="uinvalido"></div></label>
        </div>
        <div class="mdl-textfield mdl-js-textfield" style="padding: 22px 0;">
            <input class="mdl-textfield__input" type="text" 
                   placeholder="Asunto" required
                   id="asunto" name="asunto" pattern="[A-Za-z0-9_-]{1,20}">
            <label style="visibility: visible "class="mdl-textfield__label" for="Usuario"><i class="material-icons">description
            </i></label>
            <label style="visibility: visible; text-align: right;" class="mdl-textfield__label"><div id="uinvalido"></div></label>
        </div> 
        <div class="campos">
            <label>Mensaje:</label>
            <textarea id="mensaje" class="cont_email" name="mensaje"></textarea>
        </div>
        <div class="mdl-dialog__actions" style="padding: 10px 0px 8px 0px;">
            <button type="button" class="mdl-button">CERRAR</button>
            <button type="button" class="mdl-button envia_email">ENVIAR</button>
        </div>
    </form>
</dialog>

this script is for sending an email

<script>
        $(".envia_email").on('click', function (v) {
            v.preventDefault();
            v.stopImmediatePropagation();
            var cod1 = document.getElementById("destino").value;
            destino = cod1;
            var cod2 = document.getElementById("asunto").value;
            asunto = cod2;
            var cod2 = document.getElementById("mensaje").value;
            mensaje = cod2;
            var denvio = {
                "v2": destino,
                "v3": asunto,
                "v4": mensaje
            };
            $.ajax({
                url: "enviaemail.php",
                type: "post",
                data: "destino=" + destino + "asunto=" + asunto + "mensaje=" + mensaje,
                success: function (algo) {
                    if (algo === 'enviado') {
                        alert('exitoso');
                    } else if (algo === 'fallido') {
                        alert("fallido");
                    }
                },
                error: function () {
                    alert("no enviado");
                }
            });
        });
</script>

What I still do not get is to attach the table in some format to be sent also in the mail, I hope you can help me ...

    
asked by csjo 15.05.2018 в 15:44
source

0 answers