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

Discussions relating to plugin development, and the Jiwa API.

Insert pictures or change font color in the email body

Postby ivywu » Mon Nov 30, 2015 2:08 pm

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
ivywu
I'm new here
I'm new here
 
Posts: 2
Joined: Wed Nov 11, 2015 4:29 pm

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

Postby Mike.Sheen » Tue Dec 01, 2015 12:26 pm

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 490 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
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2497
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 770

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

Postby ivywu » Tue Dec 01, 2015 1:56 pm

Hi Mike,
Thank you for the help. It works now. Cheers, Ivy
ivywu
I'm new here
I'm new here
 
Posts: 2
Joined: Wed Nov 11, 2015 4:29 pm

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

Postby Accounts3178 » Tue May 10, 2022 1:53 pm

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
Accounts3178
I'm new here
I'm new here
 
Posts: 2
Joined: Tue Aug 10, 2021 3:42 pm
Topics Solved: 0

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

Postby SBarnes » Tue May 10, 2022 4:08 pm

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);
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1649
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 182


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 18 guests