HTML EMAIL with absolute image links - Javamail - jakarta-mail

I'm trying to send html email with following content:
<p><img alt="" src="http://www.xyz.com/uploads/images/abc.JPG" style="width: 400px; height: 225px;" /></p>
but not getting send? i have no options to make images as attachment because i'm using html editor to put n upload images in content, and saving this html content to send as email.
Normal html email is getting send properly but not when i include any image with direct url to their location.
Please help, thanks

however issue is solved now, i was setting message body directly in MimeMessage object with setContent method, doing it with Multipart and MimeBodyPart fixed the problem.

Related

translate <img width="68" height="18" src="cid:ii_jfppcl910_162a1546c5df71b3">

Reading An Email in Java Swing App.
I have an HTML string received from email that contained an inline image
I retrieved and stored the image "image.001.jpg"
Now I want to View The E-Mail in an JTextPane with the text and inline image
How do I translate the CID:ii_jfppcl910_162a1546c5df71b3 to the jpg image I have saved?
My Resulting HTML line would be:
<img src="image.001.jpg" alt="some_text" width="300" height="200"/>
Thanks In Advance.
I would suggest not translating that and just saving the files from the email to a file system storage directory. Then showing the HTML with the BrowserComponent. You can pass a path to FileSystemStorage into the browser component and it should "just work".

angular-file-upload - display uploaded image in browser without streaming it from backend

I am using nervgh/angular-file-upload to let the user take a photo from his mobile phone camera and upload it. It works fine, but now I want to display the image too. Of course I could add that functionality to my backend and just use the img-tag and point it to the URL. But since I upload the my JavaScript file already has to have the file at some point, right?
How do i display it?
I tried it like this:
<img ng-src="data:image/JPEG,{{uploadedImage}}">
but couldn't get it to work. According to the wiki of angular-file-upload I have control over an "FileItem", but I can't seem to figure out where the actual file-date is stored.
So my question is: Is it possible to use img tag with ng-src to display a file that is directly stored in JavaScript as byte array and where does angular-file-upload store the actual array-data
You need to make use of ngf-thumbnail option
<div|span|...
*ngf-thumbnail="file" //Generates a thumbnail version of the image file
ngf-size="{width: 20, height: 20, quality: 0.9}" the image will be resized to this size
// if not specified will be resized to this element`s client width and height.
ngf-as-background="boolean" //if true it will set the background image style instead of src attribute.
>
Take a look at this fiddle Click Here
<img ng-show="myForm.file.$valid" ngf-thumbnail="picFile" class="thumb">
This line is helping us to show a thumbnail of the image being uploaded by the user, you can choose different html tags as suggested above. You have to link the image using the file name, the ng-model in that case is picFile and that is being used as ngf-thumbnail.
You can use your own css on it as well.
you could use fileReader.
bind the ngModel file then convertit to base64 and use it as the image source
var reader = new FileReader();
reader.readAsDataURL(scope.ngModel);
reader.onload = function(readerResult) {
$scope.$apply(function(){
$scope.mysrc = reader.result;
});
};

ImgCached in IONIC - How to cached img in Inline HTML

i use ionic to build cross-platform app.
In out program we need load some post from server like: promotion/ news.
To achieve it, i use ng-bind-html:
<div ng-bind-html="inlineHtml|hrefToJS" style="padding:0px 10px 0px 10px">
I want to cached image in those post to client, that way my app can work offline have native mode, and smoothly.
i use: https://github.com/chrisben/imgcache.js/ to cached image
each time want to cached something , i just need add directives "img-cache" to img or div like this:
<div class= "ProductImage" img-cache ic-bg="{{$root.config.imgUrl+image}}">
</div>
But with inline html ( ng-bind-html above), i can replace all tag <img src = "" > in post to <img img-cache src = ""> but cached not happen, maybe directives img-cache not called.
I try to use $sce to set trust JS and html , but still can not solve problem.
Can you help me solve this case.
Many thanks!.

iframe not working on angularjs

I am trying to get an iframe to work with AngularJS, but I don't know why it wont load my iframe src.
I have some angular double bracket variables, that I want to put at the end of the iframe src, but when I do it, I get a error.
The iframe code looks like this:
<iframe name="deltager" src="http://someurl.com/somefile.php?id={{item.id}}" frameborder="0" style="width: 100%; height: 45px !important;" scrolling="no"></iframe>
It is the {{item.id}} that doesn't work.
I have tried to put a ordinary link, without the variable, and it works fine.
I tried to inspect the app with chrome inspect, and the error that i get is:
Error: [$interpolate:noconcat] http://errors.angularjs.org/1.3.13/$interpolate/noconcat?p0=http%3A%2F%2Fsomeurl.com%2Fsomefile.php%id%3D%7B%7Bitem.id%7D%7D
at Error (native)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:37:417
at g (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:119:378)
at Pa (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:99:179)
at W (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:84:359)
at T (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:82:392)
at T (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:83:55)
at T (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:83:55)
at T (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:83:55)
at T (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:83:55)
Is there anyone who knows how I can get iframe src to work with angular variables.
Thanks in advance.
Have you tried using the ng-src attribute?
If the link is an external resource, you will need to configure the $sce service to trust the url.
<iframe ng-src="http://www.gravatar.com/avatar/{{item.id}}" ></iframe>

Generating img tags with AngularJS and Docpad

I am using DocPad for generating static content for my blog. Lately, I have been blogging on AngularJS.
I seem to be having an issue with how DocPad is generating attributes for some tags like img, especially for two use cases.
First, I want to demonstrate how you should use the ng-src tag and NOT the src tag in an image. I demonstrate this by showing 404 errors on page load. So I have the following HTML in my markdown file
<td><img src="{{album.image}}" alt="{{album.album}} Cover Image" ></td>
to demonstrate this. However, during the DocPad processing it prepends the local directory to create
<td><img src="/2014/01/angularjs-lou-reed/{{album.image}}" alt="{{album.album}} Cover Image" ></td>
When the AngularJS engine processes the page, I get 404 errors on the images.
The second issue is when I use the ng-src attribute. During processing, I am guessing, that since the src attribute of the image tag is missing it adds a src attribute into the generated HTML.
So the HTML
<td><img ng-src="{{album.image}}" alt="{{album.album}} Cover Image"></td>
gets generated into
<td><img ng-src="{{album.image}}" alt="{{album.album}} Cover Image" src="/2014/01/angularjs-lou-reed/undefined"></td>
I am pretty new to DocPad and green with NodeJS. Any ideas where to look to resolve this? I think what I would like to do is if certain attributes contain AngularJS of {{ }} to skip the the normal processing.
You can see the generated page at
http://www.jptacek.com/2014/01/angularjs-lou-reed/

Resources