"""
+
+def get_monthly_bulk_mail_limit():
+ import webnotes
+ # if global settings, then 500 or unlimited
+ if webnotes.conn.get_value('Email Settings', None, 'outgoing_mail_server'):
+ return 999999
+ else:
+ return 500
\ No newline at end of file
diff --git a/erpnext/startup/schedule_handlers.py b/erpnext/startup/schedule_handlers.py
index 021cb1f600..2df7a5789d 100644
--- a/erpnext/startup/schedule_handlers.py
+++ b/erpnext/startup/schedule_handlers.py
@@ -42,7 +42,7 @@ def execute_daily():
run_fn(send)
# send bulk emails
- from webnotes.utils.email_lib.bulk import cleanup
+ from webnotes.utils.email_lib.bulk import clear_outbox
run_fn(clear_outbox)
def execute_weekly():
diff --git a/erpnext/website/blog.py b/erpnext/website/blog.py
index 5692f51f43..ea1992b1fe 100644
--- a/erpnext/website/blog.py
+++ b/erpnext/website/blog.py
@@ -106,6 +106,25 @@ def add_comment(args=None):
return comment_html
+@webnotes.whitelist(allow_guest=True)
+def add_subscriber():
+ """add blog subscriber to lead"""
+ full_name = webnotes.form_dict.get('your_name')
+ email = webnotes.form_dict.get('your_email_address')
+ name = webnotes.conn.sql("""select name from tabLead where email_id=%s""", email)
+
+ from webnotes.model.doc import Document
+ if name:
+ lead = Document('Lead', name[0][0])
+ else:
+ lead = Document('Lead')
+
+ lead.unsubscribed = 0
+ lead.blog_subscriber = 1
+ lead.lead_name = full_name
+ lead.email_id = email
+ lead.save()
+
def get_blog_content(blog_page_name):
import website.web_cache
content = website.web_cache.get_html(blog_page_name)
diff --git a/erpnext/website/doctype/blog/blog.js b/erpnext/website/doctype/blog/blog.js
new file mode 100644
index 0000000000..b0c1ec284d
--- /dev/null
+++ b/erpnext/website/doctype/blog/blog.js
@@ -0,0 +1,25 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+cur_frm.cscript.refresh = function(doc) {
+ if(!doc.__islocal && doc.published && !doc.email_sent) {
+ cur_frm.add_custom_button('Email Subscribers', function() {
+ $c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
+ cur_frm.refresh();
+ });
+ })
+ }
+}
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
index e361ece996..786941c7e1 100644
--- a/erpnext/website/doctype/blog/blog.py
+++ b/erpnext/website/doctype/blog/blog.py
@@ -29,6 +29,31 @@ class DocType(website.web_page.Page):
super(DocType, self).__init__('Blog')
self.doc, self.doclist = d, dl
+ def send_emails(self):
+ """send emails to subscribers"""
+ if self.doc.email_sent:
+ webnotes.msgprint("""Blog Subscribers already updated""", raise_exception=1)
+
+ from webnotes.utils.email_lib.bulk import send
+ from markdown2 import markdown
+ import webnotes.utils
+
+ # get leads that are subscribed to the blog
+ recipients = [e[0] for e in webnotes.conn.sql("""select distinct email_id from tabLead where
+ ifnull(blog_subscriber,0)=1""")]
+
+ # make heading as link
+ content = '