Forum Moderators: coopster

Message Too Old, No Replies

Email delete function

         

Kysmiley

2:37 pm on Jun 7, 2004 (gmt 0)

10+ Year Member



Im looking for ideas on writing a function or finding one that would delete table content based on email being returned based on either unsubscribe or on email bouncing. I am just in the organization phase of writing this script.
Pat

jatar_k

4:24 pm on Jun 7, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I have heard many recommendations for using Procmail [procmail.org] to process email.

SofterLogic UK

4:41 pm on Jun 7, 2004 (gmt 0)

10+ Year Member



It depends on your mail server. If you run, for example, qmail, you can probably just do a daily grep of the server, as all the emails are kept as plaintext files.


$text = system("grep -Rl unsubscribe /var/qmail/mailnames/yourdomain.com/unsubscribe/Maildir/*");

The contents of text will then be a \n seperated list of direct file names for all emails containing the word "unsubscribe" that are within your "unsubscribe@yourdomain.com" email account.

You can then parse out (preg_match) or similar the email address and other particulars you may want, before deleting the files.