2017-04-21 67 views
0

我有一個jQuery UI對話框,其中我有4個文本字段是發件人電子郵件,收件人電子郵件,標題和消息。從jquery對話框發送郵件

我從其他地方獲取標題和消息,並將其存儲在對話框的文本字段中。 這是我的代碼 -

var $dialog = $('<div id="myDialog"></div>') 
       .html('<form>Sender Email <input id=senderemailAddresss type="text" class="w3-input w3-border" value="[email protected]" size="25"><br> Receiver Email <input id=receiveremailAddresss class="w3-input w3-border" type="text" value="[email protected]" size="25"><br>Title<input id=title class="w3-input w3-border" type="text"> <br>Messgae <textarea id=message class="w3-input w3-border" style="height:60px type="text" rows="4" cols="20"></form>') 
       .dialog({ 
        autoOpen: false, 
        modal: true, 
        height: 700, 
        width: 500, 
        draggable: false, 
        title: "Send Mail", 
        buttons: { 
         "Send": 
         function() 
         { $(this).dialog("close"); }, 
         "Cancel": 
         function() 
         { $(this).dialog("close"); } 

         }, 
        open: function (event, ui) { 
         $(".ui-dialog-titlebar-close", ui.dialog | ui).hide(); 
        // $("#title").val($rootScope.maintitle); 
        $(this).find('#title').val("Title is :"+ title); 
        $(this).find(text).val("Message is :"+test1+" \n "+"\n new line :"+ test2+"\n again new line " +test3) 

        $(this).css('overflow', 'auto'); 
        } 
        }); 
       $("#title").val(''); 
       $dialog.dialog('open'); 

現在,這裏點擊發送時,我關閉對話框,而不是我想要發送的郵件。我怎麼能這樣做?

+0

您可能想看看[EmailJS](http://emailjs.com?src=so),它允許直接從Javascript發送使用預建模板的電子郵件[免責聲明 - 我是創作者之一] – Sasha

回答

0

這是不可能從UI發送電子郵件。但是你可以使用mailgun.com等第三方服務。或者如上所述編寫後端代碼。