// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com) // // MIT License (MIT) // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // EMAIL // Autosuggest defaults _e.email_as_field = 'email_id'; _e.email_as_dt = 'Contact'; _e.email_as_in = 'email_id,contact_name'; sendmail = function(emailto, emailfrom, cc, subject, message, fmt, with_attachments) { var fn = function(html) { $c('webnotes.utils.email_lib.send_form', { 'sendto':emailto, 'sendfrom': emailfrom?emailfrom:'', 'cc':cc?cc:'', 'subject':subject, 'message':replace_newlines(message), 'body':html, 'full_domain': wn.urllib.get_base_url(), 'with_attachments':with_attachments ? 1 : 0, 'dt':cur_frm.doctype, 'dn':cur_frm.docname, 'customer': cur_frm.doc.customer || '', 'supplier': cur_frm.doc.supplier || '' }, function(r, rtxt) { // } ); } // build print format _p.build(fmt, fn); } _e.make = function() { var d = new Dialog(440, 440, "Send Email"); var email_go = function() { var emailfrom = d.widgets['From'].value; var emailto = d.widgets['To'].value; if(!emailfrom) emailfrom = user_email; emailto = emailto.replace(/ /g, ""); // validate email ids var email_list = emailto.split(/[,|;]/); var valid = 1; for(var i=0;i