In our WCF app, there is a method to send an html formatted email. I am using StringBuilder to build the html.
I am including an image in the email. When the app sends the email, the email is formatted correctly. However, the image doesn't display unless the user right clicks and selects "Download the Image".
Is there a way to have the image automatically display in the html email without the user having to select download image?
Here is my image tag:
<img src='http://www.MySite.com/Images/Mylogo.png' border='0' />
This is intentional behavior of the email client, there's no way to guarantee that the image will automatically show for all clients. You're going to have to live with that. In fact, some people prefer to read email in plain text.
If the image is relatively small, you might consider attaching it to the email instead. You'd have a better chance of having it displayed by default, though there are obviously other costs.
Related
I am trying to add some images to the email body that gets sent to the users email (not as attachments) but when they arrive via the email they are broken and do not show.
I have tried using:
<img src="https://example.com/wp-content/uploads/2019/11/myimage.jpeg">
<img src="wp-content/uploads/2019/11/myimage.jpeg">
<img src="uploads/2019/11/myimage.jpeg">
But nothing works, I thought it would be as easy as adding an image as you do via html but it doesnt seems to work. Does anyone know how to do this?
Are you sending the email as an HTML doc or are you just putting HTML text into the email doc?
Your email service might be reading your code incorrectly, thinking it's just text being sent in an email document.
Do some troubleshooting. Can other HTML elements (like headings and hyperlinks) appear in your email? If not, it's an email problem and not one with your code.
That being said, the 2nd and 3rd links are not viewable via a browser - it looks like they are pulling from your system as opposed to being an online link. That might be part of the problem as well.
It is possible to send an entire site (that has only 1 image, a logo) via mail?, the workflow would be:
user opens the mail
user sees the attachment "html" file
user clicks the attachment, the browser opens.
I have no idea if this is possible.
Another thing, this has to work on mobile, iOS more precisely.
Until now we were sending interactive pdfs to the users, but now we want to include iOS users as well, so this strategy could work, if it works of course.
And unfortunately, no, I can't send a link to a website, it has to work this way, for reasons that are beyond my decision.
You have three options:
Send a link to your website.
Send the mail with an attachment of the HTML of your website. (since it is simple, you said just 1 image and logo it can fit in one HTML file).
Send an HTML formatted email, where you display the image and the logo.
If you want it to work on mobile, just use media querys for it to change styles depending on widht and height of the device.
I have a scenario where I want to check whether the alt-text of image, added on mail, is shown correctly while sending a mail or not. To test this, we added an img tag in mail but gave nothing in src and added an alt-text.
Now the problem is that the outlook-2010, instead of showing the alt-text, shows its own message "the linked image cannot be displayed.....". How can we avert this message to check our alt-text. Is there a better way to test such scenario in outlook-2010.
You can't control such things. You have control over an alt text styling (in some cases), but some mail clients will do whatever they want with your html and inline styles.
The only solution is to make sure your mail can be read without images, like adding a text close to the image. Most of the time, my templates have both the image and the text close to one another.
Test in Gmail (or Yahoo or anything else) instead. Outlook won't show ALT text. Here is some reference to which clients support displaying ALT text
I have some html that has an image in a table. The table displays fine in a UIWebView. I take that same html and send it in an email (using MFMailComposeViewController). The code snippet to build the html is:
html += "<tr><td><img src=\"reading.png\" align=left></td><td>"
The table is created properly, but the image just has a question mark in a blue box. (Obviously, it can't find the image, but why?)
How do I fix this?
The path "reading.png" is not found, that is the reason why you do not see the image.
There are in fact several potential solutions.
1) put the image to the web URL something like http://yourweb address.com/reading.png, this works well and will show, all the clients supports this and user just need to click to "show images" if he/she has it disabled by default in the email client.
2) second solution is to put the specific image representation to the img tag, you can do so by opening the file, reading its content and adding it as base64 data to the src of the img, there are plenty of samples for this.
3) third is to add it as attachment to the email. Again plenty of samples here and on the web how to do that.
Conversion of the sample code from ObjectiveC is simple to Monotouch.
Hope this helps.
I have created an email template, I use PHP to send the email, but the problem is that images that I have included inside the email template are not being displayed properly. It's showing the cross symbol. In Outlook, they mention "click here to download the image" - but nothing happens when I click.
What is the solution for this? How can I send the email along with the image?
You are best off not sending images in the email itself, but rather linking to them on the web. So, in your email, you have:
<img src="http://www.example.org/picture.jpg" alt="My Picture">