How to add embedded resource into ASP.NET MVC2 View? - asp.net-mvc

I creating emails using partial views and saving them in DB (later they will be sent). I need to embed image into email to display in gmail. How to do this in ASP.NET MVC 2 project? How to embed image into view to make it work and display image in gmail?

You can't. Well, not reliably anyways. At least not in the way you mean. There is such a thing as data-url's, that allow you to embed an image into the page, but you will find that this is not widely supported by email clients and thus is not a reliable way to include images.
In fact, creating emails with embedded content is something of a black art. There are so many gotchas with various email client support that you have to do a lot of research into what does and doesn't work.
However, in general, what you want to do is use an embedded MIME image attachment in the email multi-part mime format, which has nothing whatsoever to do with MVC. All you would do in MVC is create your email with the appropriate tag (ie. <img src="cid:logo_sml.jpg">) to extract the mime content from the email, note that you won't see anything in a browser, as it only works in an email client.
You might want to read articles like these:
https://www.campaignmonitor.com/blog/post/3927/embedded-images-in-html-email
http://emailmarketing.comm100.com/email-marketing-tutorial/embedding-images-in-email.aspx
How to embed images in email
sending mail along with embedded image using asp.net

Related

Add images into rails article

With Rails 5.1 and a pgsql database: I have a pretty standard Article model with :title and :description. Users can make your typical text-only articles.
What if users wanted to embed a gif or image into the post, like between paragraphs? I see a lot of this type of format on other website blogs and I am not sure how to achieve this with Rails.
Note also I am using simple_format(article) to display, so any formatting done on creation should hold.
Any ideas?
There is actually quite a bit of work involved with this:
If you need to allow your users to upload images from their
computer, you will need to get your head around the Paperclip
gem (or similar). This will store the image on the server.
You'll want to determine how big can images be, what to name the
images once uploaded and what file formats are permitted to prevent
users uploading all sorts of files.
Next on the front-end, you can either use a rich text editor (eg. CKEditor or TinyMCE are the main ones) to embed the
IMG tag(s) into your Article text, or structure that layout yourself
(eg. "Always display an image before/after the article text"). Do
your images need captions? Do they need to be clickable?
Lastly, in your Show template, don't forget to use Rail's image tag helpers rather than your standard IMG tags. This enables you
to easily reference the images on the server without getting lost in
the asset pipeline.
There are some videos out there showing how all this is done, eg. https://www.youtube.com/watch?v=Z5W-Y3aROVE. Good luck!

Send email as PDF in ruby on rails in Typo3

I have an web-application in RoR which calculates some energy values and investment money. I use ajax to send the data from the web-browser to the server. It is something like this: Browser-server-Browser-Server-Browser
This web-application is already integrated in typo3 and I want to implement a PDF button to send the results per email (in other words, a photo of the page with the results).
I have heard an option would be to generate some links in RoR to be used in typo3 (when clicking on it, it would open exactly the web-application with the results already calculated). But as a newbie, I do not really know which would be the best approach.
Any recommendation?
A screenshot of the page can be done client-side:
http://html2canvas.hertzen.com/
You could even have another page with the same results that you use only for the rendering of the result page what you use for making a clean screen-shot (you might not want to have the footer, menu and other elements on that page, only the results)
Once you have your screenshot, you can upload it to your server where you can use it to create a PDF of that image and then send it with any mail API you prefer to use.
info about TYPO3's mail api can be found here:
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Mail/Index.html

PDF4NET pdf's not showing the bound content when viewed on iOS default pdf reader

I am using Version 4.4.1.0 of O2S.Components.PDF4NET
I am using this in an MVC project to run through a series of 6 views and fill an object with the data required for the PDF.
When the PDF is bound and emailed in the last step it works great. all except for when it is viewed by default PDF reader on iOS devices.
My company purchased this product on the cheaper plan so the 90 support is over and I cannot access any sort of forums from there site.
I read a similar issue regarding a button not being displayed on iOS but there was no resolution other then to email the company.
I hope that there is a viable solution as I would prefer not to have to cut my losses and change to a different product over something as short sighted as not supporting/testing against one of the more common platforms people use to consume media.
I'm not sure what you mean by 'bound content' but I assume you are talking about form fields.
Forms fields and annotations are not displayed by the CGPDF API in iOS, only the main page content is displayed. It is not a limitation of PDF4NET, it is a limitation of the iOS PDF display engine. The workaround is to flatten the form fields thus making them part of the page content.
If this is not your situation, please send a mail to support and they will help you.
Disclaimer: I work for the company that develops PDF4NET.

can i use input type = file in my single page application

I'm writing my first single page application and have a requirement by where the user is going to need to upload documents and/or images.
Is this a show stopper for using a spa or is there a work around?
I seem to be able to find very little on this on the net so I'm wondering if this requirement would mean creating a normal mvc site?
Its possible to upload files using ajax, so no show stopper there. you might need a controller to accept the file though, but that shouldn't be an issue.
Check out this tutorial on an ajax upload
http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
or you can check out uploadify, i think that does file upload via ajax too

How do i create a image displaying a email with rails?

In my webapp i want to display user emails. But i dont want spam boots to steal my user emails. So have do i automatic create a image displaying there email?
Best regards,
A rails beginner
Creating an image is one way to go, but remember that OCR is getting to be an extremely "cheap" operation and isn't a guarantee that a bot wouldn't analyze all the pictures on your site to see if they contain text that looks like email addresses. There's plenty of techniques to "hide" addresses in plain sight. Write them out in character entity format, intersperse empty tags, uses javascript to decode an encoded form of them and insert into the page after load, etc...

Resources