Page 1 of 1

Insert pictures or change font color in the email body

PostPosted: Mon Nov 30, 2015 2:08 pm
by ivywu
Hi guys,

Is it possible to insert a picture or change font color in the email body of the Debtors Statement?
So a signature or seasonal greeting can be included in the email.

Kind regards,

Ivy

Re: Insert pictures or change font color in the email body  Topic is solved

PostPosted: Tue Dec 01, 2015 12:26 pm
by Mike.Sheen
To do this, the email message needs to have a property set - "BodyIsHTML" needs to be set to true.

The attached plugin will do that for when emailing from the debtor statements form:
Plugin Debtor Statements - Email as HTML.xml
Sample Plugin
(29.7 KiB) Downloaded 1183 times


Then the body text needs to be set as HTML - this is found in the Debtor tab of the System Configuration form - locate the "EmailDebtorStatementBody" setting and replace it with your own HTML.

With the attached plugin, and the following HTML:

Code: Select all
    <h1><font color="blue">Customer Statement</font></h1>
    Dear Customer,</br>
    </br>
    Please find attached your latest debtor statement.</br>
    </br>
    Regards,</br>
    </br>
    Jiwa Financials<br />
    <br />
    <img src="http://www.jiwa.com.au/images/logo.png" />


The email renders like this:
HTMLStatementEmail.PNG
Rendered Email



You may have trouble putting the HTML in the system setting if it contains line feeds and you are trying to paste it in. In that case, using a SQL query you can perform the update instead:

Code: Select all
UPDATE SY_SysValues
SET Contents = '   
    <h1><font color="blue">Customer Statement</font></h1>
    Dear Customer,</br>
    </br>
    Please find attached your latest debtor statement.</br>
    </br>
    Regards,</br>
    </br>
    Jiwa Financials<br />
    <br />
    <img src="http://www.jiwa.com.au/images/logo.png" />
'
WHERE IDKey = 'EmailDebtorStatementBody'
AND Section = 'DebtorParams'


Mike

Re: Insert pictures or change font color in the email body

PostPosted: Tue Dec 01, 2015 1:56 pm
by ivywu
Hi Mike,
Thank you for the help. It works now. Cheers, Ivy

Re: Insert pictures or change font color in the email body

PostPosted: Tue May 10, 2022 1:53 pm
by Accounts3178
Hi Guys
Just wanted to know if we can "ADD" the customers account number to the subject line of the email for statements?
So we have this at the moment:
Your Statement as at %AsAtDate%
But we would like to add - Acc: 002244 after the date

We just don't know the code to use for Debtors Account Number.

Thanks

Re: Insert pictures or change font color in the email body

PostPosted: Tue May 10, 2022 4:08 pm
by SBarnes
If it is of any interest to do images you can do html like


Code: Select all
  <span style=""FONT-FAMILY: Arial,sans-serif;COLOR: black;"">                               
 <img alt="""" src=""EmailHeader.jpg"" border=""0"" align=""top"">                                       
</span>         


and then in plugin code something like the below to use attachments instead of the image needing to be available on the web

Code: Select all
                  JiwaFinancials.Jiwa.JiwaApplication.Manager manager = salesorder.Manager;
      JiwaFinancials.Jiwa.JiwaApplication.JiwaEmail.EmailMessage email = manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaApplication.JiwaEmail.EmailMessage>(null);
      email.CreateNew();
      email.BodyIsHTML = true;
      
      JiwaFinancials.Jiwa.JiwaApplication.Documents.Document hdoc = manager.CollectionItemFactory.CreateCollectionItem<JiwaFinancials.Jiwa.JiwaApplication.Documents.Document>();
      hdoc.PhysicalFileName = "EmailHeader.jpg";
      hdoc.FileBinary = File.ReadAllBytes(header);
      email.Attachments.Add(hdoc);