Basically i want to make an app which will check that user has opened the sent mail or not
just like the script of "[http://www.readnotify.com][1]" like we have to just add
readnotify.com after the receivers email address before sending the email.
i have read that it is done by adding the img tag with very small size(1*1) in the email
<img src="http:/yoursite.com"/>
something like the above code and we got even the geolocation of the receiver.
How are they doing this behind the scenes??
means what they are doing in their PHP code ??
Image is generated by your script, which reads $_SERVER variables ( http://php.net/manual/en/reserved.variables.server.php ). Then you can get clients IP and so on. But rest assured, that most of mail clients do not open images unless user permits it beforehand.
Related
in my company we use to send mails, and we want to have a static of opened mails and from which browser they were opened( more informations as possible) using PHP.
You can do this by adding image in your HTML email
<img src="https://example.com/images/YOUR_LOGO__uc_12245.png" />
But this url https://example.com/images/YOUR_LOGO__uc_12245.png must be handled by your scripts (PHP) where you can check headers of request and at the end just return requested image as normal. Some services do that way. In uc_12245 you can store id of your user, for example.
But remember, this is will not work every time, for example with Gmail, because Gmail show your image via proxy (it needs to be tested, maybe it still will work).
Example: if I want to upload a video to some video service website (such as Youtube) by email, I can send a video to an email address (e.g 1234567890#upload.youtube.com). The number is an upload code - It's a unique number and changes every time. Then Youtube will process and upload my video automatically.
How did they create the email address 1234567890#upload.youtube.com, and how did they process an email message that a user has submitted?
I'm looking for the basic functionality behind this kind of web-application.
I've never done this, but I have a basic idea of how this is done.
There's a mail server on upload.youtube.com waiting for any email no matter who's the recipient.
Once it gets a message it will pipe it to a script which can parse it and get the recipient address (that's the uploader's unique identifier).
Then it will look in the email for the attachment and get MIME code, base64-decode it and then write it to a file on a disk.
Then it will add an entry in the database with the user's unique identifier and the link to that uploaded content.
if you use cPanel you could use something like http://www.zubrag.com/scripts/cpanel-create-email-account.php to create the email accounts (use your own routines to generate the unique username etc) then you could use a script like http://garrettstjohn.com/entry/extracting-attachments-from-emails-with-php/ to get the attachments from the email.
Finally, I figured out what I want.
All I have to do is handle with catch-all email on my web control panel. In my case, I just create a new subdomain and set a catch-all email option on that subdomain.
You can do all of above in Cpanel easily - just create a subdomain and selected a radio box Pipe to a Program and fill your application path. That's it!
Unfortunately, I'm using DirectAdmin. I have to do more complicated than Cpanel. It can handle with catch-all email as well, but I have to use wildcard dns for my subdomain record first.
In addition, I found this useful article about how to Pipe / Send Email to PHP Script. This article will show you every step including a PHP script for using with email piping.
Thank you for all answer. It's very helpful.
That's nice to know that you have achieved this.
I am here to introduce you to a script that can help you. The script is dealing with the dynamic email addresses with PHP. You can see the script at github and there is a premium version of this software you can see a demo here. You can buy the script from codecanyon.
I was just wondering some hidden potential in a device I own, and after thinking a while, came up with this:
If an email is sent to "name#domain.com" (this would be specific to the device) from a specific sender, with a part of the body of the message containing a link, can I make a PHP script that accesses said account via POP3, detect emails sent to the address via a specific sender, and then download the file (link) in the email with string "http://www.domain.com/redirect.html?_encoding=" to a directory on my server?
Basically this:
specified sender emails "name#domain.com" with an email that contains a link specified above. PHP script (being called by a web browser) uses POP3 to download the link in the email from the specified sender, saves it to "C:\directory\filename.suffix" automatically?
Even better, is it possible without a PHP script, something that would automatically download the link when the email is received and save it to a directory on the local computer?
Thanks, I'm just trying to find if it is even possible and not waste my time.
Have a look at flourish fMailbox. You can easily access your emails via POP3 with that and check them for your criteria.
One disadvantage if you run the script regularly (e.g. with a cronjob): It's based on the email's 'uid', which probably means 'unique id' - but (at least in my case) it's not so unique at all and changes if you delete emails from the server. So in other words, it's not a unique id but describes the nth email, counting from the first one. So if you don't want to start from the beginning each time you check your mails, you a.) have to store your last 'uid' somewhere and start from there and b.) should not delete emails from the server.
For the rest of your question:
Look if there's a specific link in there: http://de.php.net/manual/en/function.strpos.php
Download the contents: http://de.php.net/manual/en/function.file-get-contents.php
Yes, it's possible. Click this link and scroll-down all the way to the bottom where a user left a comment regarding accessing POP3 folders:
http://php.net/manual/en/book.imap.php
i'm new in php. I want to send an email to someone and afterwards i need to check if this mail could be received. How do i do that? Hope you guys understand my problem ;).
Thanks in advance. Marc
That's a really sticky question. The only real way is to have PHP monitor an inbox to check for "undeliverable message" notices you might get back. If you're really wanting to go forward with it, look into POP3 connectors for PHP. Like this: http://pecl.php.net/package/POP3
if (strpos(strtolower($subject), 'undeliverable') !== false){
//do whatever you want with the address that couldn't be reached
}
You technically wouldn't need a compiled PHP extension for POP3 (especially if you're new to PHP)... you could connect and read messages by opening a socket and speaking mail server:
http://www.adamsinfo.com/a-rudimentary-php-pop3-example/
Edit (years later):
Definitely check out http://mailgun.net/, http://sendgrid.com/, and http://postmarkapp.com/.
If you're sending HTML mails, you could use a little trick:
generate a unique id for the mail you are sending (based on content and recipient)
include an image that is loaded from your webserver
<img src="http://yourdomain.com/tracker.php?id=1234567" />
in tracker.php, log the id that called the script and send a 1px by 1px image
This won't work though, if the mail client does not download images from the internet when showing an email, as Thunderbird does, for example (IIRC Outlook does so too)
There is no definite solution for this. Web bugs are a o.k. idea but they're dying out, as they are very problematic security wise and are blocked by default in every current E-mail client I know of. I would suggest a combination of checking a bounce inbox like brianreavis suggested, and in addition, requesting a delivery receipt using the following header line:
Disposition-Notification-To:<xxx.xxx#example.com>
That way, you can get most negatives (bounced mails) as well as many positives (receipts). Sending the receipt can be blocked by the sender, but together with parsing error notifications, you should have fairly reliable system.
One option is a Web Bug but these are far from 100% reliable, and are arguably not a nice way to behave. It won't differentiate between emails which are unread and those which are undelivered, for example because of a bad email address, and it is possible to read an email containing a Web Bug without triggering it.
In short you create an HTML email containing an element which has a URL on your site which is unique to that email. So if a client accesses that URL you can be sure that someone has read your email. Wikipedia gives this example:
For example, an e-mail sent to the address somebody#example.org can contain the embedded image of URL http://example.com/bug.gif?somebody#example.org. Whenever the user reads the e-mail, the image at this URL is requested. The part of the URL after the question mark is ignored by the server for the purpose of determining which file to send, but the complete URL is stored in the server's log file. As a result, the file bug.gif is sent and shown in the e-mail reader; at the same time, the server stores the fact that the particular e-mail sent to somebody#example.org has been read.
However, it is possible - probably quite likely - that someone can read your email without connecting to that URL. This may because:
A lot of email readers block such links by default because of privacy concerns precisely because of Web Bugs like this.
They read the email in text only, either because their email client is configured to do so or because it can't display HTML email, for example, a lot of mobile phone clients.
This is a often used option - both by spammers and more responsible marketers - but I probably wouldn't recommend it unless you fully understand its limitations and implications in terms of what people might think of you if you do use it.
There is a perfect solution, in terms of knowing the eMail has been read.
The bad part is that the body of the eMail must be stored on web server.
The trick:
-Send an eMail just just a small text and a URL, so the user must go to that URL to read de content of the eMail.
In other words... on the eMail there is nothing about what you want to send, there is only a link to a unique page you create before sending such eMail.
So to read the content the user must open a web browser and go to such URL.
The trick is to put a little of such text on eMail... something like: bla, bla, bla ... press here to read more.
The concept: Online body, offline URL to access such body.
That way you can be sure of this: if URL has been read, the eMail has been read.
The bad part is that the info you want to send is not on the eMail, must be on a unique webpage.
So you must control no robot can go to such URL... for example with URL like:
https://server/private/?eMail_Body=user
Hope this idea can help someone.
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");