My emails are not sending, nor PFDs being created (PFD button), but only when I add my own custom elements to the theme. When I use a different theme it’s happy to create the PDF.
Here’s the error output:
WebException: System.Net.WebException: Error: SendFailure (Error writing headers) ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (IAsyncResult asyncResult) <0x40658460 + 0x0010b> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (IAsyncResult ar, Boolean ignoreEmpty) <0x406583a0 + 0x0002b> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (IAsyncResult result) <0x40653ac0 + 0x00227> in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, Boolean throwOnError, IAsyncResult result) <0x4067ea40 + 0x00207> in <filename unknown>:0
at System.Net.WebConnectionStream+<SetHeadersAsync>c__AnonStorey1.<>m__0 (IAsyncResult r) <0x4067e2e0 + 0x0014f> in <filename unknown>:0
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Net.WebClient.DownloadDataInternal (System.Uri address, System.Net.WebRequest& request) <0x4063de30 + 0x0032f> in <filename unknown>:0
at System.Net.WebClient.DownloadData (System.Uri address) <0x4063dc30 + 0x00057> in <filename unknown>:0
at System.Net.WebClient.DownloadData (System.String address) <0x4063d5e0 + 0x00033> in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Net.WebClient:DownloadData (string)
at ManagerServer.PdfConverter.Img (IHtmlImageElement node) <0x4062c980 + 0x003bf> in <filename unknown>:0
at ManagerServer.PdfConverter.ContentElement (INode node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40625f40 + 0x00503> in <filename unknown>:0
at ManagerServer.PdfConverter.ContentElement (INode node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40625f40 + 0x00e57> in <filename unknown>:0
at ManagerServer.PdfConverter.ContentElement (INode node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40625f40 + 0x00e57> in <filename unknown>:0
at ManagerServer.PdfConverter.ContentElement (INode node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40625f40 + 0x00e57> in <filename unknown>:0
at ManagerServer.PdfConverter.Tr (IHtmlTableRowElement node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40624b00 + 0x0013f> in <filename unknown>:0
at ManagerServer.PdfConverter.Table (IHtmlTableElement node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40627e50 + 0x00433> in <filename unknown>:0
at ManagerServer.PdfConverter.ContentElement (INode node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40625f40 + 0x001f7> in <filename unknown>:0
at ManagerServer.PdfConverter.ContentElement (INode node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40625f40 + 0x00e57> in <filename unknown>:0
at ManagerServer.PdfConverter.Tr (IHtmlTableRowElement node, Apitron.PDF.Kit.Styles.Text.Font font) <0x40624b00 + 0x0013f> in <filename unknown>:0
at ManagerServer.PdfConverter.ConvertHtmlToPdf (System.String input, System.IO.Stream output, Apitron.PDF.Kit.FixedLayout.PageProperties.PageBoundary pageBoundary) <0x40550000 + 0x00ae7> in <filename unknown>:0
at ManagerServer.HttpHandlers.Pdf.Post () <0x4068f070 + 0x00633> in <filename unknown>:0
Here’s my code for the theme (some bits hashed), custom stuff at the end:
<table style="padding: 30px">
<thead>
<tr>
<td colspan="99">
<table style="margin-bottom: 20px"><tr>
<td style="font-weight: bold; font-size: 32px">{{ title }}</td>
{% if business.logo != null %}<td style="text-align: right"><img src="{{ business.logo }}" style="max-height: 150px; max-width: 300px"></td>{% endif %}
</tr></table>
<table style="margin-bottom: 20px"><tr>
<td>
<div><b>{{ recipient.name }}</b> {{ recipient.code }}</div>
<div>{{ recipient.address | newline_to_br }}</div>
<div>{{ recipient.identifier }}</div>
</td>
<td style="border-right-width: 1px; padding-right: 20px; text-align: right">
{% for field in fields %}
<div style="font-weight: bold">{{ field.label }}</div>
<div style="margin-bottom: 10px">{{ field.text }}</div>
{% endfor %}
</td>
<td style="padding-left: 20px; width: 200px">
<div style="font-weight: bold">{{ business.name }}</div>
<div>{{ business.address | newline_to_br }}</div>
<div>{{ business.identifier }}</div>
</td>
</tr></table>
<div style="font-size: 14px; font-weight: bold; margin-bottom: 20px">{{ description }}</div>
</td>
</tr>
<tr>
{% for column in table.columns %}
<td style="font-weight: bold; padding: 5px 10px; text-align: {{ column.align }}; border-left-width: 1px; border-bottom-width: 1px; border-top-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if column.nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ column.label }}</td>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in table.rows %}
<tr>
{% for cell in row.cells %}
<td style="padding: 5px 10px; text-align: {{ table.columns[forloop.index0].align }}; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if table.columns[forloop.index0].nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ cell.text | newline_to_br }}</td>
{% endfor %}
</tr>
{% endfor %}
{% for column in table.columns %}
<td style="border-bottom-width: 1px; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}"> </td>
{% endfor %}
{% for total in table.totals %}
<tr>
<td colspan="{{ table.columns | size | minus:1 }}" style="padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.label }}</td>
<td style="border-color: #000; border-left-width: 1px; white-space: nowrap; border-right-width: 1px; border-bottom-width: 1px; padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.text }}</td>
</tr>
{% endfor %}
{% for field in custom_fields %}
<tr>
<td colspan="99">
<div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
<div>{{ field.text | newline_to_br }}</div>
</td>
</tr>
{% endfor %}
{% if emphasis.text != null and emphasis.positive %}
<tr><td colspan="99">
<div style="text-align: center; margin-top: 40px">
<span style="color: #006400; border-width: 5px; border-color: #006400; padding: 10px; font-size: 20px">
{{ emphasis.text | upcase }}
</span>
</div>
</td></tr>
{% endif %}
{% if emphasis.text != null and emphasis.negative %}
<tr><td colspan="99"><div style="text-align: center; margin-top: 40px"><span style="color: #FF0000; border-width: 5px; border-color: #FF0000; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div></td></tr>
{% endif %}
</tbody>
{% if title == 'Invoice' %}
{% for total in table.totals %}
{% if total.label == 'Total' %}
{% assign totalN = total.text %}
<tr><td colspan="99">
<table><tr>
<td>
<p style="text-align: left; margin-top: 40px">
<strong>EFT Banking details:</strong><br>
Bank: ######<br>
Account Number: #####<br>
Branch code: ######<br>
Ref: {{ reference }}<br>
</p>
</td>
<td>
<p style="text-align: right; font-size: 14px; font-weight: bold; margin-top: 40px">
<strong> SnapScan, card services -> </strong><br>
</p>
</td>
<td>
<div style="text-align: center; margin-top: 25px">
<a href="https://pos.snapscan.io/qr/######?id={{ reference }}&amount={{ totalN | remove:'.' | remove:'R'}}">
<img src="https://pos.snapscan.io/qr/#######.svg?id={{ reference }}&amount={{ totalN | remove:'.' | remove:'R'}}&snap_code_size=100">
</a>
<a href="https://www.payfast.co.za/eng/process?cmd=_paynow&receiver=######&item_name={{ reference }}&amount={{ totalN | remove:'R'}}">
<img src="https://www.payfast.co.za/images/buttons/light-small-paynow.png">
</a>
</div>
</td>
</tr></table></td><tr>
{% endif %}
{% endfor %}
{% endif %}
</tr></tr></table>
Any ideas what the error is? The email failure is similar, just with less output.
*Edit
So after experimentation, it’s the pictures (pay now button and snapscan code).
The PDF generator seems to be having issues with the .png and .svg.
With SVG it shows “unsupported file format”.
@lubos, what you think is the issue?