I am doing a mail fetching website which will fetch the unsubscribed mailing list from gmail,yahoo.hot mail,aol. User will log in and put their mail id and then scan will appear to check how many unsubscription mailing list are there.Now user can remove those mailing list or ignore it. If unsubscription link need any popup window or another page to unsubscribe then in my website there will be a link to delete it after scanning of the mail. (Sometimes unsubscription is done automatically ). Here is my code to extract the email header only but i dont know how to determine the unsubscription mail and then my next operation .Please help me out from this situation as I am googling throughout the whole day. I have removed my username password from email.
Code:
copywindow.addEvent('domready',function()
{
var togglers = $$('div.toggler');
if(togglers.length)
var gmail = new Fx.Accordion(togglers,$$('div.body'));
togglers.addEvent('click',function()
{
this.addClass('read').removeClass('unread'); });
togglers[0].fireEvent('click'); //first one starts out read
});
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'www@example.com';
$password = 'password';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
$emails = imap_search($inbox,'ALL');
if($emails) {
$output = '';
rsort($emails);
foreach($emails as $email_number) {
$overview = imap_fetch_overview($inbox,$email_number,0);
$message = imap_fetchbody($inbox,$email_number,2);
//this is my code to fetch the unsubscription mail list, but does not work
$fwd = strpos($overview[0]->subject,'Fwd:');
$cc = strpos($overview[0]->subject,'Cc:');
$bcc = strpos($overview[0]->subject,'Bcc:');
$re = strpos($overview[0]->subject,'Re:');
$output.= '<div class="toggler">';
$output.= '<span class="subject">'.$overview[0]->subject.'</span>';
$output.= '</div><br>';
}
echo $output;
}
imap_close($inbox);
Comment