Question

I would like to know, when I receive an email to my personal address "contact@MySite.com", if the sender wrote me from my website "MySite.com" clicking the "mailto" link or not. In principle I can just add the "Subject" tag to the mailto scheme but the user can delete it and anyway I don't want it to be visible. I thought I could add custom header tags and I tried the following:

<a href="mailto:contact@MySite.com?X-Mailer=FromMyWebsite">
        <span class="label">Contact me </span>
        <span class="strap">Send me an email</span>
</a>

and I tried it. The email I received contained "X-Mailer: Apple Mail (2.1510)" in the header. I thought that my email client replaced the X-Mailer tag and I added a custom one, like following:

<a href="mailto:contact@MySite.com?X-Origin=FromMyWebsite">
        <span class="label">Contact me </span>
        <span class="strap">Send me an email</span>
</a>

but the header of the email didn't contain any X-Origin field. Am I doing something wrong? How can I know if an email has been sent from my mailto link or not keeping it hidden to the sender? Thanks in advance for your answers!

Was it helpful?

Solution

I don't believe it is possible to set header information this way. It also arguably shouldn't be possible in the first place.

If this information is really so important to you, a better way to do this might be (mis)using the recipient address. Say you use an address like

contact.website@example.com

this method is

  • 100% compatible with all E-Mail clients

  • hard for the user to change (as they can't be sure whether their message will arrive if they do)

  • infinitely extensible - you could go as far as storing information about the user's visit in a database, and send a random ID in the E-Mail through which you can connect the web site visit to the E-Mail:

    contact.website.1ahGfd23@example.com
    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top