@@ -110,6 +110,7 @@ def get_customer_supplier(args=None): | |||||
def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', send_me_a_copy=False): | def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', send_me_a_copy=False): | ||||
footer = None | footer = None | ||||
if sent_via: | if sent_via: | ||||
if hasattr(sent_via, "get_sender"): | if hasattr(sent_via, "get_sender"): | ||||
d.sender = sent_via.get_sender(d) or d.sender | d.sender = sent_via.get_sender(d) or d.sender | ||||
@@ -2,4 +2,4 @@ | |||||
<p>You have a new message from: <b>{{ from }}</b></p> | <p>You have a new message from: <b>{{ from }}</b></p> | ||||
<p>{{ message }}</p> | <p>{{ message }}</p> | ||||
<hr> | <hr> | ||||
<p><a href="{{ link }}">Login and view in Browser</a></p> | |||||
<p><a href="{{ link }}">Login and view in Browser</a></p> |
@@ -2,9 +2,9 @@ | |||||
<p>Dear {{ first_name }}{% if last_name %} {{ last_name}}{% endif %},</p> | <p>Dear {{ first_name }}{% if last_name %} {{ last_name}}{% endif %},</p> | ||||
<p>A new account has been created for you.</p> | <p>A new account has been created for you.</p> | ||||
<p>Your login id is: <b>{{ user }}</b> | <p>Your login id is: <b>{{ user }}</b> | ||||
<p>Click on the button below to complete your registration and set a new password.</p> | |||||
<p><a class="btn-primary" href="{{ link }}">Complete Registration</a></p> | |||||
<p>Click on the link below to complete your registration and set a new password.</p> | |||||
<p><b><a href="{{ link }}">Complete Registration</a></b></p> | |||||
<br> | <br> | ||||
<p>You can also copy-paste this link in your browser <a href="{{ link }}">{{ link }}</a></p> | <p>You can also copy-paste this link in your browser <a href="{{ link }}">{{ link }}</a></p> | ||||
<p>Thank you,<br> | <p>Thank you,<br> | ||||
{{ user_fullname }}</p> | |||||
{{ user_fullname }}</p> |
@@ -4,273 +4,16 @@ | |||||
<meta name="viewport" content="width=device-width" /> | <meta name="viewport" content="width=device-width" /> | ||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||||
<title>{{ subject or "" }}</title> | <title>{{ subject or "" }}</title> | ||||
<style> | |||||
/* ------------------------------------- | |||||
GLOBAL | |||||
------------------------------------- */ | |||||
img { | |||||
max-width: 100%; | |||||
} | |||||
body { | |||||
width: 100% !important; | |||||
height: 100%; | |||||
} | |||||
.wrapper { | |||||
background-color: #eee; | |||||
} | |||||
.wrapper * { | |||||
margin:0; | |||||
padding:0; | |||||
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; | |||||
font-size: 100%; | |||||
line-height: 1.6; | |||||
} | |||||
/* ------------------------------------- | |||||
ELEMENTS | |||||
------------------------------------- */ | |||||
.wrapper a { | |||||
color: #348eda; | |||||
} | |||||
.btn-primary{ | |||||
text-decoration:none; | |||||
color: #FFF !important; | |||||
background-color: #348eda; | |||||
border:solid #348eda; | |||||
border-width:10px 20px; | |||||
line-height:2; | |||||
font-weight:bold; | |||||
margin-right:10px; | |||||
text-align:center; | |||||
cursor:pointer; | |||||
display: inline-block; | |||||
border-radius: 25px; | |||||
} | |||||
.btn-secondary { | |||||
text-decoration:none; | |||||
color: #FFF !important; | |||||
background-color: #aaa; | |||||
border:solid #aaa; | |||||
border-width:10px 20px; | |||||
line-height:2; | |||||
font-weight:bold; | |||||
margin-right:10px; | |||||
text-align:center; | |||||
cursor:pointer; | |||||
display: inline-block; | |||||
border-radius: 25px; | |||||
} | |||||
.last { | |||||
margin-bottom: 0; | |||||
} | |||||
.first { | |||||
margin-top: 0; | |||||
} | |||||
.padding{ | |||||
padding:10px 0; | |||||
} | |||||
.left-padding { | |||||
padding-left: 10px; | |||||
} | |||||
.breadcrumb { | |||||
list-style: none; | |||||
} | |||||
.breadcrumb > li { | |||||
display: inline-block; | |||||
margin-left: 0px; | |||||
margin-right: 5px; | |||||
} | |||||
/* ------------------------------------- | |||||
BODY | |||||
------------------------------------- */ | |||||
table.body-wrap { | |||||
width: 100%; | |||||
padding: 10px; | |||||
} | |||||
table.body-wrap .container{ | |||||
border: 1px solid #f0f0f0; | |||||
} | |||||
/* ------------------------------------- | |||||
FOOTER | |||||
------------------------------------- */ | |||||
table.footer-wrap { | |||||
width: 100%; | |||||
clear:both!important; | |||||
} | |||||
.footer-wrap .container p { | |||||
font-size:12px; | |||||
color:#666; | |||||
} | |||||
table.footer-wrap a{ | |||||
color: #999; | |||||
} | |||||
/* ------------------------------------- | |||||
TYPOGRAPHY | |||||
------------------------------------- */ | |||||
.wrapper h1, | |||||
.wrapper h2, | |||||
.wrapper h3{ | |||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; | |||||
line-height: 1.1; | |||||
margin-top:15px; | |||||
margin-bottom:15px; | |||||
color:#000; | |||||
line-height: 1.2; | |||||
font-weight:200; | |||||
} | |||||
.wrapper h1 { | |||||
font-size: 36px; | |||||
} | |||||
.wrapper h2 { | |||||
font-size: 28px; | |||||
} | |||||
.wrapper h3 { | |||||
font-size: 22px; | |||||
} | |||||
.wrapper hr { | |||||
margin: 20px 0; | |||||
border-top: 1px solid #eee; | |||||
} | |||||
.wrapper p, | |||||
.wrapper ul, | |||||
.wrapper ol { | |||||
margin-bottom: 10px; | |||||
font-weight: normal; | |||||
font-size:14px; | |||||
} | |||||
.wrapper ul li, | |||||
.wrapper ol li { | |||||
margin-left:5px; | |||||
list-style-position: inside; | |||||
} | |||||
/* --------------------------------------------------- | |||||
RESPONSIVENESS | |||||
Nuke it from orbit. It's the only way to be sure. | |||||
------------------------------------------------------ */ | |||||
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */ | |||||
.container { | |||||
display:block!important; | |||||
max-width:600px!important; | |||||
margin:0 auto!important; /* makes it centered */ | |||||
clear:both!important; | |||||
} | |||||
/* Set the padding on the td rather than the div for Outlook compatibility */ | |||||
.body-wrap .container{ | |||||
padding:20px; | |||||
} | |||||
/* This should also be a block element, so that it will fill 100% of the .container */ | |||||
.content { | |||||
max-width:600px; | |||||
margin:0 auto; | |||||
display:block; | |||||
} | |||||
/* Let's make sure tables in the content area are 100% wide */ | |||||
.content table { | |||||
width: 100%; | |||||
} | |||||
a.no-decoration { | |||||
text-decoration: none; | |||||
color: inherit; | |||||
} | |||||
small, .small { | |||||
font-size: 85%; | |||||
} | |||||
.text-muted { | |||||
color: #999999; | |||||
} | |||||
pre, code { | |||||
font-family: monospace !important; | |||||
} | |||||
</style> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<div class="wrapper"> | |||||
<!-- body --> | <!-- body --> | ||||
<table class="body-wrap"> | |||||
<tr> | |||||
<td></td> | |||||
<td class="container" bgcolor="#FFFFFF"> | |||||
<!-- content --> | |||||
<div class="content"> | |||||
<table> | |||||
<tr> | |||||
<td> | |||||
{{ content }} | |||||
</td> | |||||
</tr> | |||||
</table> | |||||
</div> | |||||
<!-- /content --> | |||||
</td> | |||||
<td></td> | |||||
</tr> | |||||
</table> | |||||
<!-- /body --> | |||||
<div style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">{{ content }}</div> | |||||
<!-- footer --> | <!-- footer --> | ||||
<table class="footer-wrap"> | |||||
<tr> | |||||
<td></td> | |||||
<td class="container"> | |||||
<!-- content --> | |||||
<div class="content"> | |||||
<table> | |||||
<tr> | |||||
<td align="center"> | |||||
{{ footer }} | |||||
</td> | |||||
</tr> | |||||
</table> | |||||
</div> | |||||
<!-- /content --> | |||||
<div style="margin-top: 30px; font-family: Helvetica, Arial, sans-serif; font-size: 11px;"> | |||||
{{ footer }}</div> | |||||
</td> | |||||
<td></td> | |||||
</tr> | |||||
</table> | |||||
<!-- /footer --> | <!-- /footer --> | ||||
</div> | |||||
<div class="print-html">{{ print_html or "" }}</div> | <div class="print-html">{{ print_html or "" }}</div> | ||||
</body> | </body> | ||||
</html> | </html> |
@@ -6,13 +6,14 @@ import frappe | |||||
from frappe import msgprint, throw, _ | from frappe import msgprint, throw, _ | ||||
from frappe.utils import scrub_urls, cstr | from frappe.utils import scrub_urls, cstr | ||||
import email.utils | import email.utils | ||||
from markdown2 import markdown | |||||
def get_email(recipients, sender='', msg='', subject='[No Subject]', | def get_email(recipients, sender='', msg='', subject='[No Subject]', | ||||
text_content = None, footer=None, print_html=None, formatted=None): | text_content = None, footer=None, print_html=None, formatted=None): | ||||
"""send an html email as multipart with attachments and all""" | """send an html email as multipart with attachments and all""" | ||||
emailobj = EMail(sender, recipients, subject) | emailobj = EMail(sender, recipients, subject) | ||||
if (not '<br>' in msg) and (not '<p>' in msg) and (not '<div' in msg): | |||||
msg = msg.replace('\n', '<br>') | |||||
msg = markdown(msg) | |||||
emailobj.set_html(msg, text_content, footer=footer, print_html=print_html, formatted=formatted) | emailobj.set_html(msg, text_content, footer=footer, print_html=print_html, formatted=formatted) | ||||
return emailobj | return emailobj | ||||
@@ -189,7 +190,6 @@ class EMail: | |||||
def get_formatted_html(subject, message, footer=None, print_html=None): | def get_formatted_html(subject, message, footer=None, print_html=None): | ||||
# imported here to avoid cyclic import | # imported here to avoid cyclic import | ||||
import inlinestyler.utils | |||||
message = scrub_urls(message) | message = scrub_urls(message) | ||||
rendered_email = frappe.get_template("templates/emails/standard.html").render({ | rendered_email = frappe.get_template("templates/emails/standard.html").render({ | ||||
@@ -204,7 +204,7 @@ def get_formatted_html(subject, message, footer=None, print_html=None): | |||||
if frappe.local.flags.in_test: | if frappe.local.flags.in_test: | ||||
return rendered_email | return rendered_email | ||||
return cstr(inlinestyler.utils.inline_css(rendered_email)) | |||||
return rendered_email | |||||
def get_footer(footer=None): | def get_footer(footer=None): | ||||
"""append a footer (signature)""" | """append a footer (signature)""" | ||||
@@ -16,8 +16,6 @@ slugify | |||||
termcolor | termcolor | ||||
werkzeug | werkzeug | ||||
semantic_version | semantic_version | ||||
lxml | |||||
inlinestyler | |||||
rauth>=0.6.2 | rauth>=0.6.2 | ||||
requests==1.2.3 | requests==1.2.3 | ||||
celery | celery | ||||