score:0
After many researches I found the solution , the main problem was that not all client email support data URI : What is Data URI support like in major email client software?
i was trying to open the mail from the outlook 2016 however it is not supported , when i opened from hotmail.com it worked..
the code is :
MailMessage mailMsg = new MailMessage();
SmtpClient client = new SmtpClient();
var imageData = Convert.FromBase64String(data);
var contentId = Guid.NewGuid().ToString();
var linkedResource = new LinkedResource(new MemoryStream(imageData), "image/svg+xml");
linkedResource.ContentId = contentId;
linkedResource.TransferEncoding = TransferEncoding.Base64;
var body = string.Format("<img src=\"cid:{0}\" />", contentId);
var htmlView = AlternateView.CreateAlternateViewFromString(body, null, "text/html");
htmlView.LinkedResources.Add(linkedResource);
mailMsg.AlternateViews.Add(htmlView);
score:1
Get rid of the beginning part of the string: "data:image/svg+xml;base64," that part is not base64, just the remainder is. You don't need to use HttpUtility.UrlDecode either.
You should specify the TransferEncoding as Base64:
res.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
However with all that said, there are some strong caveats to using SVG in email. So you may want to consider a different format such as JPG or PNG. If that's the route you take, you will need to use a library to convert formats.
Source: stackoverflow.com
Related Query
- Exception when converting to image from Base-64 string
- Why does my Highchart look different when I transfer my code from Jsfiddle to my server?
- How to get the exported image without moving from the current window when using mobile devices
- X-axis category name from string in series list
- Converting String to Datetime Rails
- Convert from string with milliseconds to date object Javascript
- Converting svg from Highcharts data into data points
- I need Highchart watermark image when i download highchart
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Code works on fiddle but not when I do /show
- How to populate a Highcharts axis with string formatted data from a PHP array
- How to save a plot as image on disk from Viewer in RStudio?
- Issues using highcharts node export server from ClojureScript - "0x03 error when performing chart generation"
- Highchart does not load data from hidden input when using .val
- highcharts change rendered image source on click
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- How to remove outer shadow when hovered from highcharts JAVASCRIPT
- Black image bug when exporting highcharts in Firefox
- Generate image in a folder from Highchart in PHP
- Converting high chart to image and send to server using ajax call
- Get base64 image from public highchart export server
- Fetch data from firebase firestore and plot histogram using highcharts when cardview clicked - android
- passing json values to highcharts from .net code behind
- Highcharts + Angularjs : Graph doesn't redraw when adding series from an external event
- Labels string from Asp.net does not distributed in the highchart
- Hide Scrollbar when Printing highchart from export menu
- React-highcharts: how do I stop the chart from re-animating when a certain prop changes?
- How to remove bullet from tooltip when using highchart?
- How can I render a watermark image in my highchart from local directory?
- How to get image of graph from highchart in web page only?
More Query from same tag
- Highcharts drilldown not working when module is imported react
- How can i disable the autocomplete of highstocks
- How to access outer scope variables within a click function in HighCharts
- R Highcharter: How to show No Data to Display message?
- How to change data format?
- Callouts CSS implementation for highcharts not working
- Remove the border around the pie chart in high charts
- Pushing data into Highcharts Series in SAPUI5
- HIGHCHART: HOW TO START TICK AT (0,0)
- how to make barchart from date 1 until 31 with different value?
- How to get the X axis value from HighChart on android on click event
- Set specific spacing between rows and columns in Highcharts heatmaps
- Does Highchart - Heat map support SUM of values?
- Need to change title color donut highchart
- Drill Down (Highcharts) not working with dynamic data in Angular
- Can't detect click function HighCharts plotLines & plotBands.events
- How to define name and value for x axis points in Highchart
- Highcharts/stock xAxis display only year
- Highcharts: arrow being rendered on the wrong charts
- Highcharts, set legend height dynamically
- Merging related timeseries data
- Uncaught TypeError: Object [object Object] has no method 'highcharts'
- Showing arrays in an array in tooltip in Highcharts
- highcharts column stacking Y axis sync - value seem to be represented as an increase on that of previous column
- Dynamic chart is not working properly (highcharts)?
- Highchart stacked column chart missing some items
- Hightchart: Doing drilldown with columrange
- How to fill data dynamically in Highchart
- Add a Specific Y-Axis Label with Highcharts
- xaxis populated with weekdays looping