Javamail: Send a HTML mail with an "unclickable" URL on it - html

I come with an issue that is giving me some headaches.
I'm sendind some e-mail confirmations, using JavaMail and an HTML template, that is written on the message content.
This HTML template, has a URL on it, but this URL is not wrapped into a tag, it's just a plain text inside the HTML body.
The problem is that the URL appears as a clickable link on the mail message, and that's not the behavior I'd like. I'd prefer the user to copy and paste the URL to the browser (security policies at work)
Have any of you done something like this ?
Thanks in advance

You can't. You cannot control how mail user-agents handle incoming mail. Mail clients do this for the convenience of the user. I fail to see how this is a security issue.
The only alternative is to put the URI in an attached image, but that would just annoy your users.

you could explicitly code the url to not be a clickable link (a without the href)... It will still appear as a link, but it won't be clickable.
EDIT: It seems the user below is correct.
EDIT2: It actually seems I may have been correct. I tried composing an email at
http://putsmail.com/tests/838716156f824732c7f5456122c38e
with the html:
<html>
www.google.com
<a>http://www.google.com</a>
</html>
and the second link appeared as text.
You can't explicitly insert html in the gmail client, but you can with your own.
EDIT:
I went back this morning and tried this html:
<html>
www.google.com
<a>http://www.google.com</a>
http://www.google.com
</html>
and only the second link was plaintext. Just FYI...

I've found a way to do this.
The key is to insert a zero width space (​) somewhere between the URL
So, I changed my URL from
http://my.site.com/somecontext?contextid=somekeyvalue
to
ht​tp://my.site.com/somecontext?contextid=somekeyvalue
And now the URL is not interpreted as a link by the mail clients, but it's still good for a copy-paste to the browser.
Thank you all for your help!

Related

Contact form 7 adding an image to the email body

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.

HTML Inside of Link

I'm sending out an HTML email. I'd like the recipient to be able to click the link from their email inbox and then have the HTML nested inside the link to be opened and rendered in their browser.
EMAIL:
<html>
<body>
<a href= **<html><body> You're now viewing this in browser </body></html>**> Click here to render HTML in browser. </a>
</body>
</html>
This is for a work email to colleagues, hence the reason I don't have a webpage to direct them to. Thanks!
It might be possible to do something like this with a data: url, in the format:
data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E
Although I don't know if email clients will allow data: urls in links. My guess would be 'no' because it's probably a security problem.
Since you're looking to render something in a browser after clicking the link in the email, have you considered making a minimal website on a http:// url?

Plain text converts to link on mobile

I have a name like this Domain.com, in my normal e-mail account it will be displayed as plain text but at my mobile it's a link.
Is it possible to disabble it by a tag?
This is the email client adding the link afterwards. Trick is to make it unrecognizable so that it isn't triggered.
This article addresses the issue.
If you are not building a full html email (no style tag), you might be able to get away with adding a zero width space  in the domain to help break it up. Something like this might work:
http://domain.com

HTML Email jump links not working

I've written a HTML Email using tables (:sad face:) and it displays perfectly while using Internet Explorer's Send -> Page by Email. My issue is that my jump links
Go to the jump link
no longer work, thye just open the complete URL of the page that I was sending. I've looked through the source of emails in which the jump links do work and I saw that the jumps links looked like this
Word generated jump link
I tried adding this but I'm still getting IE opening and it's now going to http:///
Any idea if there's any extra tags I need to add or another way to get around this?
Essentially, this is something that has to do with the way Microsoft deals with Internet Security. It is best practice to avoid named (jump) anchors in HTML email, unfortunately. However, to overcome this you might want to provide a link to a webpage with the HTML email on, which can of course have named anchors.
You can read more about best practices for email design on this article at Sitepoint. There is also a great resource for HTML email design at the Email Standards Project.
You can try this!!
In outlook -> new email->attach file->insert(select the html file here)->insert as text(dropdown on the insert)
Which will make the jump links work.
but the problem is all with the active links and visited link color. Doing this leave you no control over visited and active link colors.
You could create the email template as signature.
Open the tempalte in IE and click CTRL+A to copy the page.
Create a signature and Page the content as it is.
Create a New email and insert the Signature. The template will be loaded.
I had the same problem. When trying to send a html page using Internet Explorer's Send -> Page by Email, the anchor pointed to the url of the webpage instead of to the internal link in the mail.
This can be solved by adding this in the head of the page:
<base href="" />

Link to Homepage is forwardslash

Im have the default routing and write a link to the Homepage in my view
Link
The generated content is a forward slash.
Link
This link works in Firefox but in IE8 no request is sent to the server when the link is clicked.
Is a forward slash a valid content in a link?
EDIT:
OMG, I tried to have an image inside the link but actually put an input type image there. The funny think is that it worked in Firefox.
Thats how my linked looked like:
<input type="image" src="/Images/buttons/btn_buy_more.gif" alt="" />
I will leave this question here so you have somebody to laugh about.
Url.Action isn't supposed to send a request to the server. It just generates a link address. Look at the generated URI in the HTML source of the rendered page. I'll bet it's the same in both browsers.
What I think you mean is that clicking the link is behaving differently for you. To figure out why, use Fiddler to examine the request the browser sends and the server's response.