Using MVCMailer to embed image in email - asp.net-mvc-3

How do you use MVCMailer to embed an image into a email?
I've tried something along the lines of
<img src="#Url.Abs("\\..\\images\logo.png")" \>
with no success.
Any examples?
Thanks

Look at the MvcMailer wiki
https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide
search for Embed Image and you'll and you are done!

Try like this:
<img src="#Url.Abs(Url.Content("~/images/logo.png")" />
Also make sure that the absolute url that is generated by this helper is accessible when you open the email in your mail client. For example if you hosted your ASP.NET MVC application in the local visual studio web server ensure that it is running when you try to read the email as the image must be accessible.

You have to type the entire URL where your image is, and also it has to be hosted online.
So for example , i want to embed the image that is called Logo.png and it's located in the folder Images in my project , i'll write in the view of my MvcMailer:
<img src="http://mywebsite.com/Images/Logo.png" />

Related

Advice for displaying image in MVC using inline style

I am new to MVC, so please forgive me! I have the following line in my
Views/Home/Index.cshtml file:
<div class="grid-content" style="background-image: url('~/Content/pics/mypic.jpg');">
(The _Layout.cshtml renders it using the standard RenderBody() call.)
But it will not display the pic. If I replace the path with a full qualified path to an internet pic, it will work. It won't work with the above syntax.
It seems to me that it has to do with the multiple uses of single/double quotes, maybe.
Is there a way for this to work? I have yet to learn how to make use of Url.Content, or some other helper method.
Any suggestions?
The url() you pass is a path to the resource from your web server, either relative to the calling page or an absolute URL.
The example you have provided looks like a file-system path, not a URL that your web server understands, which is why fully-qualified URLs to an "internet image" work.
Your document is stored in Views/Home/Index.cshtml. If the image is stored in the same folder , then simply change it to url('mypic.jpg'). If not, adjust accordingly.
Change the path from ~/Content/pics/mypic.jpg to something that is relative to the document you are serving. For example, if the HTML
(Yes, URLs can contain tildes, but generally they designate "what follows is a system username", like /~Coreysan/Content/pics/mypic.jpg, which would direct your web server to find your ~/<whatever your web server folder is>/Content/... resource).

Replace a remote image with a local image on static web pages

I have an image that displays stock quotes update on our website. This is being fed by an external site with a static path pointing to this remote image. (This image gets updated with stock info there). The updates don't happen now and I will have to remove this image on several static web pages on my site until something else is in place.
Is there a way I can over-write this image easily on all pages with a local image within the site? I was wondering if there is a way I can get this done on the site level, may be tweak the apache conf file. Any other work around suggestions. Please let me know. Thanks!!
Add crossorigin attribute to get images from 3rd party websites
example:
<img height="100" width="100" crossorigin=anonymous src="https://media.licdn.com/mpr/mpr/shrinknp_200_200/AAEAAQAAAAAAAAjTAAAAJDNlOGJiNTRkLTJhMzMtNDZlMi05NjJiLTZmMGRhODkzMzVkNw.jpg" />

cannot load images into dompdf on same server?

Why cant i add images on my server to a pdf? I think it has something to do with the url structure, is it supposed to be different for this scenario?
currently its:
<img src="http://mywebsite.com/images/image.jpg">

Official image host for GitHub projects?

Whenever I need to include a picture in a GitHub project's README file I usually just stick it in a Screenshots folder and relatively link to it. However this unnecessarily bloats the file size of the project, especially if I include an animated .gif of the project in action.
I've noticed in a couple popular Github iOS projects (like MMDrawerController and JASidePanels) that the images are NOT relatively linked, but rather they exist on a domain I've never seen - "https://github-camo.global.ssl.fastly.net". Navigating to this site directly doesn't work and Google searches bring up nothing. So for my question: is this site affiliated with GitHub, and how does one get his/her images uploaded here? Of course I could always use a generic image hosting service but I'd prefer to use one that has official ties with GitHub (if such a site exists).
Where is this?
GitHub itself has a "secret" feature to upload images.
I read about this in a comment by GitHub's own Phil Haack:
I edit (or create) an issue and drag it into there and copy the resulting markdown into my post. It's probably an abuse of GitHub issues.
If you do it like this, the image will be stored on some GitHub server, and it will have a URL like this one:
https://f.cloud.github.com/assets/19977/1656110/a3f8b280-5b6d-11e3-818d-c06ab05bd613.jpg
Fastly is not an image host, it's a content delivery network. See their website and this CDN Planet entry.
If you peek at the source code of the README.md page in the MMDrawerController repository, you'll notice that the image aren't initially stored at Fastly.net.
Moreover, they're supposed to be served through standard http (ie. not https).
<p align="center" >
<img src="http://mutualmobile.github.io/MMDrawerController/ExampleImages/example1.png" width="266" height="500"/>
<img src="http://mutualmobile.github.io/MMDrawerController/ExampleImages/example2.png" width="266" height="500"/>
</p>
The links your refer to are dynamically rewritten thanks to the Camo tool.
This tool simplify routing images through an SSL host in order to prevent users from being warned by their browser about potential unsecure content as every GitHub.com content is being served over https.
I built MMDrawerController. I host the images in a gh-pages repo and link to them from the README.
No you don't need a host. just put images in root of your own project and give link in readme.md
something like this
![Preview1](./img1.PNG)
![Preview2](./img2.PNG)
## and so on
Follow these steps to host the image on GitHub's official website.
Visit any repository on GitHub and click your way through to the issues.
Create a new issue by clicking the New Issue button. You'll now see the title and description fields.
Drag and drop an image onto the description field. This will start the uploading process.
Copy the URL and use it in README, issues, or pull requests however you like.
Demonstration of how it works:
Simply open the image you wish to post on GitHub, right-click, Copy Image, then in the Github post, hit ctrl-v.

MailChimp API createCampaign

I have the template i want on a server somewhere, with images and all. How do I just use that as a template? or cant you use a zipped version with all the media like you would when manually setting up a campaign ?
using mailchimp. you will be asked to upload an HTMl or create your own template. if you want you can create your own newsletter in HTML then upload the HTML in your mailchimp.
Minimize your HTML code due to compatibility and use the images that is uploaded in your server by specifying thier location like src="www.domainname.com/location/image.jpg"

Resources