By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,347 Members | 2,091 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,347 IT Pros & Developers. It's quick & easy.

Fetch Unsubscribe mail list scan it and remove / ignore

P: 1
I am doing a mail fetching website which will fetch the unsubscribed mailing list from gmail,yahoo.hotmail,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.

Expand|Select|Wrap|Line Numbers
  1. copywindow.addEvent('domready',function() 
  2. {
  3.     var togglers = $$('div.toggler');
  4.  
  5.     if(togglers.length) 
  6.  
  7.         var gmail = new Fx.Accordion(togglers,$$('div.body'));
  8.  
  9.         togglers.addEvent('click',function() 
  10.         { 
  11.             this.addClass('read').removeClass('unread'); });
  12.  
  13.             togglers[0].fireEvent('click'); //first one starts out read
  14. });
  15.     $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
  16.     $username = 'www@example.com';
  17.     $password = 'password';
  18.  
  19.  
  20.     $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
  21.  
  22.     $emails = imap_search($inbox,'ALL');
  23.  
  24.     if($emails) {
  25.  
  26.       $output = '';
  27.  
  28.       rsort($emails);
  29.  
  30.  
  31.       foreach($emails as $email_number) {
  32.  
  33.         $overview = imap_fetch_overview($inbox,$email_number,0);
  34.         $message = imap_fetchbody($inbox,$email_number,2);
  35.  
  36.                            //this is my code to fetch the unsubscription mail list, but does not work
  37.             $fwd = strpos($overview[0]->subject,'Fwd:');
  38.             $cc = strpos($overview[0]->subject,'Cc:');
  39.             $bcc = strpos($overview[0]->subject,'Bcc:');
  40.             $re = strpos($overview[0]->subject,'Re:');
  41.  
  42.  
  43.                 $output.= '<div class="toggler">';
  44.                 $output.= '<span class="subject">'.$overview[0]->subject.'</span>';
  45.                 $output.= '</div><br>';
  46.  
  47.  
  48.       }
  49.             echo $output;
  50.     } 
  51.  
  52.     imap_close($inbox);
Oct 13 '11 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
you know that PHP works on the server side and JavaScript on the client side?
Oct 19 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.