Thanks!  After removing the @ signs it started complaining about my supplied
argument being wrong.  Upon closer inspection it looks like $connnection
isn't the same as $connection and I had another variable as $conn which
should have been $connection.  Freaking typos!

It works great now.

On Wed, Jun 9, 2010 at 2:53 PM, Michael Jones <[email protected]> wrote:

> The script looks fine, and is very close to one I've used before.
>
> Do you get any errors if you remove the @ in front of the imap_delete and
> imap_expunge calls?
>
> Michael
>
> On Wed, Jun 9, 2010 at 12:28 PM, Caleb Call <[email protected]> wrote:
>
> > I've been trying to write a script to delete emails.  The server is an
> > exchange server, but I've been using imap to connect.  I have a script
> that
> > pulls the messages from today and then does some sorting/counting/etc of
> > the
> > messages and then emails to results.  What I need to do now is delete the
> > emails that are in the inbox.  Ideally, if I could delete the messages
> that
> > are >1day old, but I'll take just deleting them all each day.  Obviously
> > these emails are not mission critical, they are emails that are sent to a
> > catch-all mailbox.  This is what I have come up with, but it doesn't
> work:
> >
> > <?php
> > date_default_timezone_set('America/Denver');
> > $user = 'blah';
> > $password = 'blah-blah';
> > $connection = @imap_open("{mail.server.com:143/novalidate-cert}INBOX",
> > "$user", "$password");
> > $count = imap_num_msg($connection);
> >
> > $headers = @imap_check($conn);
> > ($headers->Nmsgs > 0) or die("Trash is empty already !");
> >
> > // delete email(s)
> >  @imap_delete($connnection,'1:*');   // to clear out the entire mailbox.
> >  @imap_expunge($connection);
> >
> > imap_close($connection, CL_EXPUNGE);
> > ?>
> >
> > It runs fine, doesn't throw any errors but it also doesn't delete any
> > messages.  Any suggestions?
> >
> > Also, the connection string is the same connection string I use in the
> > script that works so I know it's connecting.
> >
> > _______________________________________________
> >
> > UPHPU mailing list
> > [email protected]
> > http://uphpu.org/mailman/listinfo/uphpu
> > IRC: #uphpu on irc.freenode.net
> >
>
> _______________________________________________
>
> UPHPU mailing list
> [email protected]
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to