Why won't Outlook use the text/plain part? - outlook

First of all, hello,
With SwiftMailer, i'm sending HTML+PLAIN emails.
On outlook, when displaying this email as plain text, this is not my plain text part showing up, but a automatic parsed version of the HTML.
Does anyone know how to force Outlook to use the text/plain part of message when displaying plain text?
My code does the following:
$plain_body = convert_html_to_text($body);
$message->setBody($body, 'text/html')
->addPart($plain_body, 'text/plain');
$body has some formatting and images:
vardump($body);
<html>
<head>...</head>
<body>
<img src="logo.png" alt="Company name" /><br />
<img src="border.png" alt="border" /><br />
<img src="face.png" alt="Mr Somebody" /><br />
<p>Hello Ninj!
You requested a confirmation by email...</p>
<img src="footer.png" alt="footer" />
</body></html>
$plain_body contains a very clean text (thanks javon):
vardump($plain_body);
"Hello Ninj!
You requested a confirmation by email..."
But in the plain text version viewed in Outlook, i see instead all the alt attributes of pics of the HTML version, one by line, then some lightly formatted text:
Company Name
border
Mr Somebody
Hello Ninj!
You requested a confirmation by email...
Footer
Thank you by advance for everyone able to help :)

Can't do that. Outlook keeps all 3 body flavors (HTML, RTF, plain text) in sync. This is done on the store provider level.
When it receives a MIME message, it uses the HTML body (if available). When the message is saved, the store provider uses the HTML body to generate the plain text body (PR_BODY property).

Related

Outlook img tag is not giving me the correct attachment id

Im trying to create a new outlook add-in that can extract the email content as html, and extracting the email content is working fine Office.context.mailbox.item.attachments
But my problem right is, If there an img tag include to the content. It will give me like this kind of img tag
<img class="x_w-1378 x_h-886" size="349452" data-outlook-trace="F:1|T:1" src="cid:9ea35d14-aa1e-47d6-9c5b-b31ced143981" style="max-width:100%">
<img width="643" height="359" id="x_Picture_x0020_1" src="cid:image001.png#01D8A327.B5A0B590" style="width:6.6979in; height:3.7395in">
I know there's an isInline properties and i can extract the base64 of the attachment.
Now question is, How would i know, if this img tag is for this attachment and vice versa? Like there's no indicator in img tag like this
<img id="AQMT12tasFGA....." src="cid:image001.png#01D8A327.B5A0B590" style="width:6.6979in; height:3.7395in">
Mime Content-Id header is used for In-line attachments, see https://www.ietf.org/rfc/rfc2392.txt for more information. Be aware, you can use EWS to get content ID values of attachments from Office web add-ins.

Typo3 close and start a new paragraph <p> in each <br /> in bodytext at news extension

I'm using Typo3 9.5.14 and CkEditor to add and edit news articles, i see in frontend that it is closing and starting a new paragraph at every in the bodytext area here an example :
<p>
Text somthing <br />
Text somthing 2 <br />
Text somthing 3 <br />
Text somthing 4 <br />
</p>
After save, i see in frontend is converted to this;
<p>Text somthing </p>
<p>Text somthing 2 </p>
<p>Text somthing 3 </p>
<p>Text somthing 4 </p>
But in source it is still in the original code even after save.
Is it really because CKEditor and how can i prevent this ?
This is causing the problem of adding new spaces between each line of text.
Possibly switch to direct source editing?
The other reason could be you need to allow tags in the editor configuration. Like this :
TYPO3 9.5.4 CKEditor RTE deletes style attributes
Hope it helps you
EDIT:
Does this setting still work in TYPO3 9? maybe that is it:
https://docs.typo3.org/m/typo3/reference-coreapi/7.6/en-us/Rte/Transformations/Tsconfig/Index.html#dontconvbrtoparagraph
I come back with the solution i find, i have uninstalled the obsolete extension rtehtmlarea, and this solved the problem.

Display ascii value into Spring input

Using spring form, we display an input like this:
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
...
<form:input type="text" cssClass="w50" path="lastName" cssErrorClass="w50 error" placeholder="${msgLastName}" />
Sometimes, the users lastname value may content single quote, eg "Job's". This probkem is that we clean the lastname with the OWASP HTML Project, which causes the lastname to be
Job's
When the input is displayed into the browser, the ascii value is also displayed - whici is bad. I would like to display simply "Job's" into the input.
I tested with a simple JSP input, eg.
<input type="text" cssClass="w50" value="${myobject.lastName}" cssErrorClass="w50 error" placeholder="${msgLastName}" />
In this case, the rendering is fine.
My conclusion is that the problem comes from spring, but how to avoid it?
Finally found the answer.
Spring HTML-escapes the values, it doesn't really output
Job's
but
Job&#39;s
As there is an HTML character, it isn't parsed as ascii.
Using Chrome, if I inspect the DOM I cannot see the
&
but if I "edit as HTML" then I see it.

How to use <br> instead of <br /> in CKeditor

It's 2017 and it's the age of HTML5! In HTML5, the line break is <br>, NOT <br />. But for the life of it, I can't get CKeditor to ditch <br /> in favor of <br>.
The incorrect <br />'s are giving me all sorts of problems. Among them:
Failed code validation
(In Firefox) Using JavaScript's innerHTML on a code block that was created with <br />'s, returns <br>'s instead - which messes up comparisons about changes.
I found this old forum entry about the issue (in a related program, not in CKeditor itself):
http://ckeditor.com/forums/Support/are-not-validated-W3C-validator-How-change
But the suggested fix (changing config.docType in the config file) does NOT WORK!
I tried a bunch of different docTypes's, in both the top-level config.js and in core/config.js .
In top-level config.js , I tried:
config.docType = '<!DOCTYPE html>';
In core/config.js, I tried:
docType: '<!DOCTYPE html>',
But nothing works! :(
I also tried to hunt down instances of <br /> in the multitudes of files, but didn't find any in the core part of CKeditor. I presume that the <br /> string gets created dynamically??
How can I get CKeditor to spit out <br> rather than <br /> ?
Thanks!
Yay, it took some hardcore Googling (hard to phrase the search), but I found the answer! I hope this will help others.
Simply add:
CKEDITOR.on( 'instanceReady', function( ev ) {
// Output self-closing tags the HTML5 way, like <br>
ev.editor.dataProcessor.writer.selfClosingEnd = '>';
});
What it does, from what I understand, is to wait for the core plugin "HTML Output Writer" to be loaded - and when it is, it modifies the "writer", which is a property of each editor instance. The above way applies the change to all editors, but it could also be done to individual editor instances (though I find it hard to imagine why anyone would want to do the latter.)
For more info, from the CKEditor4 documentation:
How Do I Output HTML Instead of XHTML Code Using CKEditor?
All right, CKEditor rocks! :D

CKEditor HTML Autocorrection Issue

I have few lines of HTML in my database. I want to edit the content in CKEditor. But when I open that in editor the HTML gets break down. The HTML gets rearranged.
Below is the HTML which is in database:
<span class="sec_title">
<h1><span>Web</span> Engineering</h1>
<hr>
</span>
And when I open it in CKEditor the HTML looks likes below:
<h1><span class="sec_title"><span>Web</span> Engineering</span></h1>
<hr />
Some one please help me. I tried config.allowedContent = true; but it is also not stopping the CKEditor to do the modifications.
CKEditor works with a valid HTML only and <h1> is not a valid content of <span>. Quoting CKEditor basic concepts:
CKEditor is not a tool that will let you input invalid HTML code. CKEditor abides by W3C standards so it will modify code if it is invalid.

Resources