I have sent email successfully.Now i want php code to get response after sending email i.e whether it is opened,bounced,delievered…so on
can anyone help me
I use code that checks the address prior to sending, so if it bounces, it doesn’t send.
function checkEmail($email){
// checks proper syntax
if(preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\\._-] +)+$/" , $email)){
// gets domain name
list($username,$domain)=split('@',$email);
// checks for if MX records in the DNS
if(!checkdnsrr($domain, 'MX')){
return false;
}
// attempts a socket connection to mail server
if(!fsockopen($domain,25,$errno,$errstr,30)){
return false;
}
return true;
}
return false;
}
function customCheckDnsrr($host,$recType=''){
if(!empty($host)){
if($recType=='') $recType="MX";
exec("nslookup -type=$recType $host",$output);
foreach($output as $line) {
if(preg_match("/^$host/", $line)){
return true;
}
}
return false;
}
return false;
}
I found this at devshed
Yes, so you make your sending mail function say: if not verified, don’t send, telling you it is fake/spam e-mail address. So if sent it would bounce, which is one of the things you wanted If it is verified, it gets delivered, which is also on your list. For your third, opened, all users need to use the same hosting. The two places I seen this work is in business where the business has it’s own e-mail server and everybody uses MS Outlook. The second place is when I used AOL (I stopped around 1999), again this only worked for aol to aol e-mail. If you sent to yahoo, it would never say opened.
Thanq for the reply
Where are you getting a response from? Once an e-mail is sent, it’s off your system and you can’t do anything with it anymore.
To track how many mails have been opened, you could put a 1*1 pixel image in the mail which is served off your server. If the image is downloaded, then a mail has been opened. You could even send some extra codes along in the request for the image so that you know which email has been opened.
However, most people I know don’t download images by default, so it won’t be a very accurate measurement.
Thnks for ur reply,
actually my code is get response through php code after sending email,u hav given code that for email address verification