This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Is there a way to determine whether an e-mail reaches its destination?
PHP: Check who had read sent email?
I need a php or zend framework code which return a acknowledgment when I send a mail.
If user receives a mail, or not, or may be email is not correct, or when user open this mail; in all these cases I to get a acknowledgement.
How do I do this?
The only way you can know if a user opened a mail to listen for resources (images) that will download to the client (if they allow downloads) otherwise you are in the dark.
Checking the mail was sent and if the address is valid can be done but only to a certain extend the server that sends the message will report if the message could be sent but that will only be the status of the sent message on that specific server. You could setup some kind of mechanism that listens for addresses that are reported by other servers as invalid but not all the servers do this ...
You could use a third-party provider to handle the acknoweldgements for you which will lift the burden from you. Like Mailchimp but they too have limited ways to do this.
Just my 2 cents
If you want to detect the mail being opened, you will need to embed an image in the e-mail. This image is generated by a PHP url like <img src="domain.com/index.php/generate_image/123"> where 123 is the User ID you put in the e-mail so you can track which user opened that e-mail.
Related
This question already has answers here:
How to check if an email address exists without sending an email?
(15 answers)
Closed 7 years ago.
Up until Facebook closed it's doors on 'Public Post Search' I used to run a site that allowed for this function. Right now am building a new site and have a landing page that allows for the visitor (old or new) to sign up to be notified when the new site is up and running. This is done via email. Unfortunately I have suffered some people inputting non email addresses so solved that with a PHP function, however more recently I've started suffering from what are clearly not valid email addresses like 'foo#bar.com' etc...
Is there a recommended PHP function to check whether the email address is fully valid? If not, is there a free service which has an API that I could use to check whether the address is valid?
The only reliable way to know if an email address is valid is to attempt to send an email to that address and check for a hard or soft bounce.
You can validate that the format of the email address satisfies format checks and therefore could be valid. foo#bar.com would pass that check.
In the ancient days of the internet (the 90's), many SMTP servers would allow one to query "is this email address valid" without going through with sending an email. That was abused by spammers to validate spam lists, so pretty much every SMTP server has that part of the protocol disabled.
I would like to find out all e-mails that have been received by our mail server from a particular IP address, contained in the Message Headers.
It is a static IP, and I have found some already by manual means, but I am trying to find a way to either do this programatically, perhaps using a PHP script with full access on my mail server, or perhaps there is a function within cPanel itself which will do this?
How would one go about searching all e-mail headers for this IP?
You may want to have a look at procmail. It's a tool that can be used to process email messages as they arrive to your mailbox. You can specify the processing on the email message based on any field in the message header. In your case, you would be considering the "Received:" field which displays the IP address upstream email server.
Although procmail is generally used for processing email as it arrives, it is also possible to use it to process existing mail stored in mailboxes if you can cat and pipe the messages from the mailbox to procmail.
There is a simple example in the link below that explains the basics of using procmail.
Howto filter and forward e-mail with procmail: example
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to check if an email address exists without sending an email?
Possible duplicate:
How to check if an email exists without sending an email?
I have a very big database with users (over 50000) and there are lots of automated e-mails the site sends out.
The problem is, quite a few of the addresses in the database (that users registered with years ago) have expired or have been deleted or no longer exist for whatever reason.
This creates an issue, because each user should have a valid e-mail.
I've been trying to find out if there's a way to detect whether an e-mail address is active, so we could update the database and prompt those users to enter a new e-mail? Something like a ping for e-mail addresses?
There's some code here that I've tried to figure out but to no avail:
http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/smtpvalidateclassphp/
Does anyone have a solution?
Please note that I need a PHP solution, not command line since I have 50k e-mails to check.
Two things, first you should stop the influx of potentially in-valid email addresses by implementing a 'closed-loop' email verification system. Basically, when a user signs up for your site, you send an email with a link confirming their email address, and when they confirm, their account gets full access to your site.
Secondly, there is no real way to determine if an an email address is invalid strictly using PHP. I had to tackle this problem a few months ago, and we ended up using the mail-server to tell us if an email address has been bounced back or not. When your mail server sends an email, and the email cannot be delivered, the recipient mail-server will respond with a bounce notification to your mail-server which includes information as to why the email was bounced. Information such as a Delivery Status Notification (DSN) code which identifies why the email address couldn't be delivered.
Some example codes:
511: Bad Mailbox
512: Bad System
516: Mailbox Moved
These codes are made up of a prefix (4 or 5) to indicate a transient (temporary) or permanent failure. The following two digit code indicates an error range; two digit codes between 10 and 19 indicate an error relating to the email address, whereas codes between 20 and 29 indicate an error relating to the email mailbox.
From these codes you can determine, based on business requirements, a 'hard bounce' or a 'soft bounce'. A hard bounce would be something like 511 (bad mailbox), where it's certain that this email address is not currently valid. A soft bounce would be something like 445 (network congested), which indicates that it was a temporary issue as to why the email could not be delivered.
So in your instance, you could send out an email blast, and then track the bounces on your mail server. By looking at each bounce and the respective DSN code, you can flag whether an account's email is valid or not (we used PHP to gain access to the mail server and parse the bounce notifications for the DSN codes)
Here is more information on DSN codes.
-- Edit --
As Dagon wisely mentioned, you can pipe bounced emails into a PHP script upon their receipt. To do this you will need to read up on your mailserver config, but ours looks similar to the following:
bouncehandler unix - n n - - pipe
user=nobody argv=/usr/bin/php /path/to/BounceHandler.php
<% end %>
The only way to check if an e-mail address is expired or not is to send an e-mail message to it and see if you get a response. But note that doing so may be considered spamming, since it is an unsolicited message.
You can check if an e-mail address if properly formed, and if the mail server it specifies actually exists, but thats about it. There is no way that I know of to check if the account exists (and if a human is reading the mail sent there) without sending a mail with a link and requesting that the user click the link.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
how to make a php script that read an email from the server?
So I want an app to send the user an email, and the user has to respond. How do I capture what the user sent back to the email?
Check the In-Reply-To header of the reply to find out which message it relates to.
There are two possibilities:
Set up a regular off-the-shelf email server, and something to parse the inbox.
Set up a special php email server that listens on port 22 and processes the incoming mail - something like james but php-based. If nothing available you'll have to roll your own.
You have to create some cron job that will retrieve inbox of your email account.
I have implemented simmilar thing but I was using tokens system too - email that was send to user had a random generated token in topic. When user replied I was looking for that token and then associate it with some 'thread' (helpdesk system).
I am building a symfony module for sending newsletters. the idea is to build a queue list of adreeses to receice the mail and then ,with a cron job, send let's say 50 at a time.
What i don't now how to do is to read the Mail Delivery reports that are sent back by the server when an email adress doesn't exist or the mail is full. The idea is to store these error reports an clean the adress list.
Any ideea how to implement that?
When reading the "bounced inbox", you can use a class like this to actually parse the mail and see what status was returned (e.g. permanent or temporary error):
http://www.phpclasses.org/browse/package/2691.html
To really parse a mail accurately will give you a hard time, as not all mailservers are alike and some will send you a "mailbox full"-error marked with a "permanent" flag while others may tell you that the error "user doesn't exist" is "temporary".
I tried a solution for this once and ended up setting up my own parser connected to a huge database containing possible server replies (and their "real" meaning :).
You can use a reply to address while sending. So bouned emails will be sent to this id. You can also create another PHP script which will read this "reply to" email inbox and get the id from it. You can then remove this id from the list you have.