How can i know if an attachment has been downloaded from mail? - php

Recently I came to know that for mails we can,
1. Track Click-Throughs
2. Track Opens
Read more from this blog You Know How I Know You Read My Email?
Now I need to know how I could know whether someone downloaded the attachments in the emails.
Is this possible?
Thanks

Attachments are part of the email, so most clients will download it with the email (e.g. desktop clients, etc).
If you want to send a file and track whether it's been downloaded, then you'll have to host it online somewhere, and email the link. When the recipient clicks the link, the website where the file is stored can track when the link has been accessed and thus tell you the file was downloaded.

In general, you can't.
The attachment is embedded in the email. There is no way to track what happens to it afterwards unless the attachment has something in it that will allow you to track opens (such as a reference to an external image in an attached HTML document).

I don't think Its possible to trace attachment download.
Only you can trace you'r email checked or not by the receiver.
Via sending the small image in to the email and call you php file path.

Related

Is there anything which tell me email is viewed by user which I send from my website in php?

I want to built a functionality which tells me that watever email sent from my website is viewed or read by user.
I saw one solution online which is about sending an image in the email and when email is read and image is opened then we have to trigger a call to our system.
But whatif image is never opened.
P.S. Email could be open in any gmail/outlook/thunderbird any.
Any help and idea would be appriciated.
I believe an image is the best way to do it, the user wouldn't have to actually open the image to record it as read. When the user opens the email, the image will load by sending a request to the src attribute which you could set as a php endpoint, for example...
<img src='http://www.example.com/mailread.php?userId=212'>
The php script would then contain some logic to record that the user has read the email and serve the image.

Link to open email client and attach file?

Not sure if this relates more to PHP or Javascript/jQuery, but is there a way to attach a file to an email client (i.e Outlook), when user click on a link/button?
I have a link that generates a PDF and I want it so that, when someone click on a link, it will open up their email client with the PDF already attached, and subject already fill in.
I know, you can use <a href="mailto:..." but that only opens up the mail client. I also need to attach a file with a subject fill in.
Is this doable with PHP or Javascript?
You can set the subject line in the mailto with
MAIL TO EXAMPLE
setting an attachment is not that easy and you would be better off providing people with a button that will trigger php to send the email (as per ott's comment).
In theory some email clients will support adding "attachment=path/to/file.txt" attribute but I have never seen it work

How do i add an attachment to an email?

This may seem like an easy question, but --
How do i make it so when a user clicks on a link on my site, it opens up an outlook (or whatever client they use) with the file (in the link) as an attachment?
I don't want to use php's mail() function since i want the user to be able to send it as an attachment him or herself.
Or is this whole thing impossible?
Thanks.
That's not possible. At most you can set the To: and Subject: lines via the link itself, but you can't force an attachment.
Click me!
Sorry, you can't do this. The best you could do is mailto link which unfortunately doesn't allow to set attachments.
You can create a form field for the user to enter his / her e-mail, then post to a php file which will grab that e-mail addr and send your attachment.
besides - mailto links are a pain in the A$$ for some users because they may be using a web based e-mail client as their primary, and a mailto will force something like outlook to open

How can I force email programs to show images send in html email using php?

I am sending an html email with php and it includes an image. Some email programs, such as gMail have a 'display images' button. The user has to click on that in order for the images in the email to show up.
Is there any way I can force email programs to show images that are sent within html emails generated by php?
As a rule of thumb, email clients are configured to display attached images by default (e.g. those with a cid: URI scheme) and not load remote images (which can include tracking information).
If you attach all the images, then you'll usually get them showing up (while inflating your SMTP bandwidth use along with that of your recipients (which can make you unpopular)).
I'm afraid not. The main reason email programs block images is because images are often used to 'report back' to whoever sent the email that the email has been opened. This is a common tactic used by spammers. Also, malicious code is often attached to images and downloading these images is how such code gets executed. Another reason email programs block images.
No, you can't force programs you didn't write yourself to do anything.
Email is hugely variable, and in general you're going to see different results in different places. That being said: There's no general way to force an email client to display images; this is why most email now includes a link at the top indicating that if it doesn't display correctly the user should click on it (which then takes the user to a standard HTML page outside the email client's image/javascript/everything-else-blocking grasp).
You specifically mention gmail so it's worth pointing out that if you embed (CID URI) the images they won't show inline, they'll show as attachments at the bottom of the message.
Doubt it, it would be a security issue if the 'src' of an image opened up a cross site scripting attack.
Cross site request forgery
Customers of a bank in Mexico were attacked in early 2008 with an
image tag in email and were sent
through their home routers to the
wrong website.
You can, but unfortunatley Trident, which is the IE rendering engine doesn't support it (surprise, surprise), but it is technically possible to include images in the html itself - see http://en.wikipedia.org/wiki/Data_URI_scheme
The last place I worked, we were sending out emails that had images in them that would come up automatically, in outlook at least, without me having to explicitly click a show images button.
When I inquired, another developer explained that they simply copied the encoded block of the image from an already sent email into the body of the email. I think this may be a weird sort of workaround they stumbled upon. I don't know if this adds more weight than an attachment, but I could see how an email reader would see an attachment and then ask the user as opposed to read it already in the body and just show it...

PHPMailer: sending email....ask for a receipt?

I am going to create a script that sends out an email. I am currently using PHPMailer. I have been told that they would like the email to request a receipt from the user indicating they read it. (like what you often see in outlook). I have no clue if this is possible. Can anyone tell me if this is possible and if so how to do it?
Thanks!!
See $ConfirmReadingTo in PHPMailer documentation
( More recent PHPMailer link on gitHub )
I'm not sure if you can use them in PHP or not a quick search showed this:
Disposition-Notification-To: you#yourdomain.com
however they are not reliable in any way as most email clients either ignore them or just allow the user to hit 'cancel' to sending a reply. I've only really seen it used in corporate/enterprise type env with Notes or Outlook.
Just something to consider, but depends on your application.
In PHPMailer you use $ConfirmReadingTo. You need to set it equal to the email address you want the confirmation sent to. Ex:
$ConfirmReadingTo: you#yourdomain.com
But some email clients (such as gmail) will just ignore this.
The best way to get a confirm from every email sent would be to send an HTML email and use a graphic to track which emails have been opened. The graphic source would be a script which you would let you check who has read the email. Ex:
<img src="http://www.yourSite.com/emailConfirm.php?FROM=someone#gmail.com&SUBJECT=The_Email_Subject" border="0" height="1" width="1">
emailConfirm.php could then generate an email to be sent to your email address.
You can use Josh’s recommendation with tracking image, but:
- use a special folder name and custom image name with .GIF extension
- track this image request by php handler, as an exception by accessing this non existing image
- generate this custom image name into the email
For example:
<img src="http://www.yourdomain.com/email/abc34642.gif">
Your php exception handler detects, that you are requesting a gif image in the folder "email", which means, someone opened your email with the identification 34642. You have to find, which recepient has this id, and you can find the neccessary information. I recommend using a generated xml file to avoid too much database queries. Don’t forget to output a real image with gif header.
This is absolutely safe against blocking your email with inappropriate image extension.
I confirm as of today the correct method is doing:
$mail->addCustomHeader("Disposition-Notification-To: youremail#mail.com");

Categories