Commit e7f4fef0 authored by Moisés López - https://www.vauxoo.com/'s avatar Moisés López - https://www.vauxoo.com/ 🖥
Browse files

[REF] attach_image_email: Using external files for template and logo

parent dd55c2ba
......@@ -8,7 +8,7 @@
{
'name': 'Attach image in email',
'version': '8.0.0.1.0',
'version': '8.0.1.0.0',
'author': 'Vauxoo',
'category': 'Addons Vauxoo',
'website': 'https://www.vauxoo.com',
......@@ -16,10 +16,6 @@
'depends': [
'base',
],
'data': [],
'qweb': [],
'demo': [],
'test': [],
'installable': True,
'auto_install': False,
}
......@@ -35,17 +35,17 @@ class IrMailServer(models.Model):
match = pattern.search(body, pos)
if not match:
break
s = match.start()
e = match.end()
data = body[s+len('"data:image/png;base64,'):e-1]
new_body += body[pos:s]
start = match.start()
end = match.end()
data = body[start + len('"data:image/png;base64,'):end-1]
new_body += body[pos:start]
fname = ftemplate % fcounter
fcounter += 1
custom_attachments.append((fname, base64.b64decode(data)))
new_body += '"cid:%s"' % fname
pos = e
pos = end
new_body += body[pos:]
return new_body, custom_attachments
......
<table border="0" cellpadding="2" cellspacing="2" align="center" width="400">
<tbody>
<tr>
<td valign="top">
<div style="font-family: 'Lucida Grande', Ubuntu, Arial,
Verdana, sans-serif; font-size: 12px; color: rgb(34, 34,
34); background-color: rgb(255, 255, 255); ">
<div class="moz-text-html" lang="x-unicode">
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tbody>
<tr>
<td valign="top">
<img src="data:image/png;base64,{image_base64}"
height="100" width="250">
</td>
</tr>
</tbody>
</table>
<div style="font-family: &quot;Lucida
Grande&quot;,Ubuntu,Arial,Verdana,sans-serif;
font-size: 15px; color: #8F41A2;
background-color: rgb(255, 255, 255);" align="left"><strong style="color: #8F41A2; font-size: 16px">
<big><b>Hello, this is a test template</b></big></strong><br>
</div>
</div>
</div>
</td>
<td valign="top"><br>
</td>
</tr>
</tbody>
</table>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment