Disabling links on Email Forward - email

I am sending emails to users which includes a one-time authentication link. I am trying to develop a feature through which if a user forwards the email to some other user, the links should get disabled.
One way is to hide the link by using a style tag which is covered here:
<style type="text/css">
blockquote .original-only, .WordSection1 .original-only {
display: none !important;
}
</style>
<p class="original-only">
Content to be hidden Unsubscribe.
</p>
Is there a better/standard way to achieve the same? I would prefer to keep the link visible but clicking on the link will take the user to my web where I can check URL params to validate if the email is original or forwarded.

I don't think it would work, but for a different reason - Office 365 can "probe" the link first to see if it points to anything untoward. Your server would register a hit, but it won't be coming from a user.

A foolproof way forward is essentially not possible, although you may be able to do it with some success on some platforms. (There isn't even a way to target all email clients individually on a straight send--let alone on a forward!)
What happens when you forward an email is that the email will be re-rendered, often without the accompanying embedded CSS that you are relying on (it depends on the email client).
So the reference to the class would be lost, and your link would now show after a forward:
<p class="original-only">
Content to be hidden Unsubscribe.
</p>
Furthermore, I see what you are trying to do there, in predicting that a forward would add a blockquote or a style like WordSection - but not all behave predictably, or if they do, you can't target them. For example, Gmail will add a class that begins with something like "_m" (from memory), but although CSS can target that with an [attribute^="value"] selector, most email clients will ignore this 'advanced' CSS.
In fact, you may have more luck reversing this:
<style type="text/css">
blockquote .original-only, .WordSection1 .original-only {
display: block !important;
}
</style>
<p class="original-only" style="display:none">
Content to be hidden Unsubscribe.
</p>
I haven't tested it, but if you sent that to, say, Gmail (noting some Gmails are different from others, e.g. IMAP/POP accounts), which DOES support embedded CSS, you would see the unsubscribe link. But forwarding might just remove the embedded CSS and so the display:none would kick in and hide the link.
However, if you sent it Outlook desktop, which does NOT support embedded CSS (anything in <style>...</style>), it would hide the unsubscribe link by default, as well as keep it hidden on a forward (probably).
Results are likely to be all over the place.

Related

Links inside email are displayed as double plain text

In our web shop we email customers after each purchase. Up until now all emails displayed properly, but now, in some cases all links inside the email is displayed as doubled plain text. This is happening only to some customers, and I can not find anything about that issue and how to solve it.
Correct Display:
Incorrect Display:
NOTE 1:
I created HTML for that email. The link is wrapped with <a> tag, but when we inspect the incorrectly displayed email, the <a> is removed and only the text is present in the DOM.
NOTE 2:
This is only happening to some customers. We checked and they don't have any ad blocked enabled. Also, this is not browser related issue since they also tried to open email on different browsers.
This happens with Outlook.com and Outlook 365 environments. If the link does not have a http:// or https:// (or other) protocol, it will do this.
Therefore, ensure all your links use a protocol, i.e. ..., and NOT ...
Just in case anyone else winds up here ... we had a similar issue
Our HTML bulk-email (sent programmatically via Exchange) showed formatted correctly in SENT ITEMS, but arrived (when viewed in Outlook) somewhat broken. It was fine if we emailed to e.g. GMail / Hotmail, so probably only a problem with Outlook rendering.
The Outlook presentation was PLAIN TEXT and not Rich / HTML. Noticeable because "View Source" was greyed out. (The content, as sent, definitely had HTML / HEEAD / BODY etc. tags, and it validated OK at W3C - Outlook removed all such HTML tags - seems strange that Outlook decided to display in plain text and then remove all the, correctly coded, HTML tags)
Some, but NOT all, yyy tags displayed wrongly - in particular the tag https://www.example.com/ was what we, eventually, found had caused the email to render (in Outlook) as plain text - all HTML tags stripped and some LINKs rendered wrongly. That HTTPS link did render correctly, but others in the same email which were coded as www.link.com/MyPath rendered as
www.link.com/MyPath<https://www.link.com/MyPath>
same with mailto: links
Removing the HTTPS:// from within the <a href...>HTTPS://xxx</a> tag fixed the problem - took us a while to find though!
So basically it seems that the HREF property should include https:// and the value within the <a> tag should NOT

IDEA: Do you think this would stop emails from being scraped?

I put a span class in the middle of the email, like so:
example<span class='scrape'>DELETE-THIS</span>#website.com
I set the scrape class to position:fixed and right:200%. The email address appears normally on the page. Then I added some Javascript that deletes the span on mousedown, since bots can't click.
What do people think? Would this stop an email from being scraped?
Most bots target a links with a regular expression looking for an # symbol and sufficiently complex ones are capable of parsing the content of a document as well as its html. While this might hinder the ability of a bot to parse it via html it does not hinder the plain text methods.
A better defense is to store the email address as a Data-Attribute and then use an event to transform it from the Data-Attribute into a MailTo: link or however you wish to use it. This will cause the page to be loaded asynchronously which will prevent most batch style bots.
This is called "email address munging". It would be cleaner to use display:none though.
It works on some bots but not all.

How can an email reply or forward be composed in html emails?

I'm creating a simple email client and I'm having trouble with Reply and Forward in html emails.
When I have the user compose the reply message, how do I append that content to the top of the message? I have done some investigating with how outlook does it by injecting the new message content into a paragraph or div or something like that.
How is it done in general, i.e. gmail, yahoo, etc. How do they figure out where to inject the reply content in the html?
I'm using c# so ideally there is some c# library that can handle this? If not then some idea how it's done generally so I can create a solution for it.
I've read wikipedia's Posting Style article and it gives a good overview of the general idea but nothing about how to do it in html.
Some Background
When composing HTML email, it is important to recognize that email clients have rather limited support for HTML and the level of support varies across email clients.
Because of that, although <div> and CSS are the correct layout tools for web pages, that is not true for HTML email. Even today, use <table> for layout control for HTML emails.
Additionally, the only reliable means to apply CSS is to the HTML elements with a style= attribute on each element. CSS declarations in a <head> section are often ignored by the email client. When crafting HTML email, I actually use CSS in the <head> and, once it looks correct, use this page to convert the HTML to use style= attributes. There are other options.
Not only will the <head> tag often be ignored, but so will any <body> tag.
Solving Your Problem
I would suggest placing the text included in the reply within a table (with a single <tr> and single <td>), and applying an inline CSS style to that table. That allows you to apply formatting, such as placing a colored bar down the left-hand side, italicizing the text, etc.).

Is there any sense in using the <title> tag in HTML e-mail?

When sending an HTML e-mail, is there any sense in using the <title> tag? In the PHP Manual, for instance, they use such a tag in their main sample code. However, I see no reason why an e-mail client would use this title and not the Subject from the e-mail. Is there any reason to set this tag?
I've been looking into this myself as I'm writing a PHP mailing list manager script that uses the sendmail() function.
The script allows the admin to create and send multiform emails (both text and html versions).
After much testing I have found that some email servers appear to have issues with the title tag (<title></title>).
I created a test email and sent it to 5 of my email address, my #blueyonder.co.uk email failed to arrive but the 4 others had no problems.
After a process of elimination it turned out that the #blueyonder.co.uk mail servers did not like the title tags in the html part of the email message, when I removed the tag the email arrived no probs.
Very strange!
The only use I would see is that some clients, like Outlook, allow you to view an email in a browser for better rendering. It would then be a plus to have the html title tag set.
(Old question, I know ;) )
My experience is that some mail clients will display the <title> tag in their email preview and some won't. Some clients preview will be "Subject + <title> + Preheader" and some will only be "Subject + preheader", so that creates an inconsistent experience.
Because of that, I found it's better to only use a preheader.
For completion's sake, the "Preheader" is a hidden text form the body that is only used in the preview, for example, something like...
<div style="display: none; max-height: 0px; overflow: hidden;">
Insert hidden preheader text here
</div>

using form buttons for spamproof email-addresses

I have been looking at some methods for spamproof email methods here. I'd like to propose a more simple approach: Since I need a couple of different email addresses I considered just using a selectbox with JS or serverside redirect, as per examples on here.
Because google doesn't spider forms (dixit Matt Cutts), and spam-harvester script don't either (I think????) this would make sense to do.
I would love to be able to do this without using a script. So why not use one form per email?
<form action="mailto:test#domain.tld" method="get">
<input type="submit" value="test#domain.tld"/>
</form>
It seems the button text can be copied but not pasted, so that's a disadvantage.
Is this approach any good? or any other recommendations?
A robot uses the text of the page to get the email. It does not care if that text is in a button or within the body so using a button will not help.
Outside of using javascript, the only solution I know of would be written text, an image or Flash.
Create an image with your email or write out the email like: "test at domain dot tld"
Flash could provide you with a more secure (but not 100%) way of allowing people to click on an email but would not work on iPhone browsers and those that do not have the plug-in.
Another way is to use a simple captcha to before displaying the email in the PHP code.
Email: (1+2 = ?) then test#domain.tld
Because:
The email address is still in the page, and thus easily harvestable
mailto: URIs as form actions often fail
The reason server side form handlers stop email addresses being harvested is because the email address is not exposed to the user.