Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


jrtwynam
2019-04-30T16:39:08Z
Hi,

I've created a VC job that executes an Oracle script, which inserts messages into an Oracle table. The VC job then retrieves these messages from the Oracle table, and I want it to email me the results. The results actually look like this:


  Checking: Store [0280], Pkt Ctrl Nbr [728570]
    Carton Header:     Expected [   10], Actual [   10]
    Carton Detail:     Expected [   61], Actual [   61]
    Pickticket Header: Expected [    1], Actual [    1]
    Pickticket Detail: Expected [   58], Actual [   58]
    Outbound Stop:     Expected [    1], Actual [    1]
    Outbound Load:     Expected [    1], Actual [    1]
  Checking: Store [0281], Pkt Ctrl Nbr [728571]
    Carton Header:     Expected [    6], Actual [    6]
    Carton Detail:     Expected [   33], Actual [   33]
    Pickticket Header: Expected [    1], Actual [    1]
    Pickticket Detail: Expected [   33], Actual [   33]
    Outbound Stop:     Expected [    1], Actual [    1]
    Outbound Load:     Expected [    1], Actual [    1]


But what's getting emailed is this:


Checking: Store [0280], Pkt Ctrl Nbr [728570]
Carton Header: Expected [ 10], Actual [ 10]
Carton Detail: Expected [ 61], Actual [ 61]
Pickticket Header: Expected [ 1], Actual [ 1]
Pickticket Detail: Expected [ 58], Actual [ 58]
Outbound Stop: Expected [ 1], Actual [ 1]
Outbound Load: Expected [ 1], Actual [ 1]
Checking: Store [0281], Pkt Ctrl Nbr [728571]
Carton Header: Expected [ 6], Actual [ 6]
Carton Detail: Expected [ 33], Actual [ 33]
Pickticket Header: Expected [ 1], Actual [ 1]
Pickticket Detail: Expected [ 33], Actual [ 33]
Outbound Stop: Expected [ 1], Actual [ 1]
Outbound Load: Expected [ 1], Actual [ 1]


So it looks like VC is taking everything that contains multiple spaces side-by-side and assuming that I meant to only use a single space. I have no idea why it's doing this, or how to stop it. It seems to me that it should be taking each line of output exactly as it appears in the first block above, and doing absolutely nothing to it other than what I tell it to do. In this case, I don't believe I've told it to replace any text.

I've tried a variety of things, although I'd think that simply inserting the StdOut variable from my SQL task into the email HTML body should be fine. I've also tried looping through each line in the results and updating a job variable to insert the appropriate HTML tags (<br>, <p>, etc). I've also tried exporting the results to a text file (that part retained the formatting), and then inserting a FileContent variable in the email's HTML body (that part removed the formatting).

Any thoughts?

Thanks.
Sponsor
Forum information
thomas
2019-04-30T17:56:23Z
You say you tried to write the data to a textfile and this kept the formatting. That leads me to believe it is not a VC issue. Is your email client Outlook by any chance? There are a lot of quirks with outlook and html. It supports only a subset of html and it sometimes behaves differently from standard html. I had to google quite a bit before I got the html in outlook mails looking nice.

Here is a link about some of the oddities in outlook:

https://www.emailonacid....emails-for-outlook-2016/ 


You can test it by sending the html in a mail to youself. If it removes the spaces, it is an outlook issue:

https://www.msoutlook.in...e-directly-into-an-email 
jrtwynam
2019-04-30T18:12:23Z
It may be an Outlook issue, but you'd think that a carriage return is a carriage return, regardless of what program is displaying it.

I wasn't able to get Outlook to properly display the results, so what I ended up doing is just attaching the text file to the email. Not exactly what I want, but at least it works. The link you mentioned said that Outlook sometimes likes to remove padding, though it wasn't clear on whether it was referring to things like cellspacing/cellpadding in HTML tags, or whether it meant whitespace in general (or both). If it meant whitespace, then I can understand it trimming the spaces from the front and back of each line, but it doesn't make sense why it would trim 5 spaces down to 1 space in the middle of a line, because that's not whitespace. Oh well, I'm not going to fiddle with it any longer. I have something sends me the results in a readable format.
bweston
2019-05-01T19:10:50Z
Originally Posted by: jrtwynam 

It may be an Outlook issue, but you'd think that a carriage return is a carriage return, regardless of what program is displaying it.

I wasn't able to get Outlook to properly display the results, so what I ended up doing is just attaching the text file to the email. Not exactly what I want, but at least it works. The link you mentioned said that Outlook sometimes likes to remove padding, though it wasn't clear on whether it was referring to things like cellspacing/cellpadding in HTML tags, or whether it meant whitespace in general (or both). If it meant whitespace, then I can understand it trimming the spaces from the front and back of each line, but it doesn't make sense why it would trim 5 spaces down to 1 space in the middle of a line, because that's not whitespace. Oh well, I'm not going to fiddle with it any longer. I have something sends me the results in a readable format.



I don't think it's exactly Outlook.

In html rendering (and you said you were sending this as an html email), the default styling for white space is "normal," which...by the standards of someone expecting to be able to go from text rendering to html rendering with minimal effort...is kind of abnormal.

https://htmldog.com/refe.../properties/white-space/ 

Because css support in email clients (especially Outlook) is notoriously more peculiar than basic HTML rendering, if you do go back and try it (or if anyone else comes across this thread trying to solve the same problem, and doesn't want to fall back on just making it a text email), what I'd suggest is wrapping the output variable in a
<pre></pre>
. You mentioned having tried wrapping the output in HTML tags for line breaks and table formatting (which, without white-space styling, would still be subject to the default rendering) but didn't mention that tag (which stands for preserve whitespace) specifically.

If you did already try that and it didn't work, then I...um...I got nothin'. Most emails sent by my company's visualcron servers are just sent as plain text because I was lazy and didn't want to mess with this exact issue.
Support
2019-05-02T14:15:04Z
You should start just writing the content to a file and investigate with Notepad++ to see if spaces are alright before inserting.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
jrtwynam
2019-05-02T18:14:12Z
@bweston:

I haven't tried the <pre> tag, mainly because I didn't know about it. My HTML knowledge is around 20 years old, and even back then I only learned the ones I used regularly, which didn't include this one. I'll give it a try at some point, although for now what I have is working.

@Support:
I did write the content to a file, which preserved all the spacing, so I'd be inclined to believe that this isn't a problem with VC specifically.
thomas
2019-05-03T13:00:00Z
I have some spare time today, so if you want to post the html you tried, I can do a little bit of testing. It would be nice to figure out what is happening.

thomas
jrtwynam
2019-05-03T14:11:18Z
Thanks for the offer, but it seems like the suggestion of using the <pre> HTML tag worked nicely. This is the HTML I'm using now:


<p>Hi,</p>

<p>There's a potential invoicing problem for the stores in the attached file. Please investigate.</p>

<p style = 'font-family: Courier'><pre>

{TASK(6ab4b133-a9a4-4347-a5a9-93b87078fa11|StdOut)}

</pre></p>


And the resulting email looked like this, which is exactly what I want:

Capture.PNG

(It seems that something is resizing the image when it gets uploaded - the actual file is proper size, but when I view the message using the Preview option in this forum, it's far too small to read.)
Support
2019-05-03T18:14:02Z
Please try uploading images again now. We fixed resize issue.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
thomas
2019-05-03T19:01:56Z
cool. Nice to know about the pre tag. It was new to me
Scroll to Top