1

is there a better way to send more "styled email"

I regularly send my customers job status reports as the order progresses through our system

ie Thanks for the order - your job is in production etc.

originally, I simply used the email field itself to call up my email client (outlook) then I had to select one of several styled templates and although they looked good , this was somewhat a faff and had many limitations. Ie i still had to key in the variable info and the templates were only local to me and not other team members..

So for the last couple of year I have used sendEmail, calling up one of several letters stored in an Admin table to send out the appropriate message, which is triggered when the various status changes. Ie if dispatched a send email button appears with an embedded script.

All works fine and so far all good - but ......

I really want to improve the style in order to sex up the design layout a bit 

so can any anyone suggest a better/more elegant way to approach this?

In addition, I always add an attachment that shows and advert or price list or whatever. Depending upon what email client my customer has, they either see this as an attachment or part of the view in the email body when they open the email itself.

is there a way to embed the attachment directly with the email body so the client does not have to open the attachment?

 

Just for ref only

here is a sample report - what the customer sees

 here is how I store the report

 

Example script from order dispatched button

if Status < 2 or Status > 3 then
    alert("job Status is not in production")
else
    Status := 3;
    if not 'Email+' then
        alert("No valid contact in email field")
    else
        if DispFlag = 1 then
            alert("Dispatched Confirmation already sent!")
        else
            let thisBody := first((select SystemFile).OrderDispatchedLetter);
            let myEmail := userEmail();
            let adv1 := concat([1, 4, 7, 10]);
            let adv2 := concat([2, 5, 8, 11]);
            let adv3 := concat([3, 6, 9, 12]);
            let mtd := text(month(today()));
            let myAtt := switch true do
                case contains(adv1, mtd):
                    first((select Mailer_Flyers).Flyer1)
                case contains(adv2, mtd):
                    first((select Mailer_Flyers).Flyer2)
                case contains(adv3, mtd):
                    first((select Mailer_Flyers).Flyer3)
                end;
            thisBody := replace(thisBody, "{Ord Company}", text('Ordered By'));
            thisBody := replace(thisBody, "{Order Name}", text('Order Name'));
            thisBody := replace(thisBody, "{Job Bag}", text('Job Bag'));
            thisBody := replace(thisBody, "{Order Date}", text('Order Date'));
            thisBody := replace(thisBody, "{Order Name}", 'Order Name');
            thisBody := replace(thisBody, "{Order Ref}", 'Order Ref');
            thisBody := replace(thisBody, "{Qty}", text(Qty));
            thisBody := replace(thisBody, "{Desc}", Desc);
            thisBody := replace(thisBody, "{Del Company}", text('Delivery To'));
            thisBody := replace(thisBody, "{Del Address}", text('Delivery Address'));
            DispFlag := 1;
            sendEmail({
                from: myEmail,
                to: 'Email+',
                subject: "Your order has been dispatched by 118 Printgroup",
                text: "Goods Dispatched Confirmation",
                html: thisBody,
                attachments: myAtt
            });
            alert("Goods Dispatched Email has been Sent");
            DisplayMenu := 1
        end
    end
end

2 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 8 mths ago
    • Reported - view

    Maybe you could find some inspiration here.

    • Mel_Charles
    • 8 mths ago
    • Reported - view

     Cheers buddy - I will take a look thanks :-)

Content aside

  • 1 Likes
  • 8 mths agoLast active
  • 2Replies
  • 106Views
  • 3 Following