Email Problem: Can VitualMin, Webmin or Postfix help me with this ?

6 posts / 0 new
Last post
#1 Wed, 12/02/2009 - 02:29
Anonymous

Email Problem: Can VitualMin, Webmin or Postfix help me with this ?

Hi,

I have a client list which I have not sent out any email to for about a year, and I sent an email last week.

Now my emails have an opt-out link which keeps the mysql database clean, as far as "don't-wanters" goes.

But, how do I clean out the the non-deliverables?

From my mail out ( of c.5000 emails), I got about 450 bounces. Obviously I don't want to keep sending out to emails to non-existent addresses so I want to somehow access those addresses and take them off of the clients table.

The reason that I know that I get the bounces is because I get an email back to my sending email address saying that it was not deliverable.

I noticed there are lots of options ın the Postfix Server Settings under the WebMin menu, but I could not find anything there to help me.

Every retum email has the following subject: "Undelivered Mail Returned to Sender" and the sender is: "Mail Delivery System MAILER-DAEMON@HEAVYHOSTER.COM

There seems to be header information like this:

Reporting-MTA: dns; heavyhoster.com X-Postfix-Queue-ID: 98D5667E62B X-Postfix-Sender: rfc822; user-group-admin@expert-world.com Arrival-Date: Fri, 23 Oct 2009 19:00:15 -0700 (MST)

Final-Recipient: rfc822; webmaster@prabhas.com Original-Recipient: rfc822;webmaster@prabhas.com Action: failed Status: 5.0.0 Remote-MTA: dns; sitemail.everyone.net Diagnostic-Code: smtp; 550 Recipient Rejected: Account Inactive

At the moment I have over 450 emails in my inbox and I want to somehow strip out the email address so that I can write to a CSV file or a mysql table.

I know a bit of php but I am not really sure of the best way to do this.

Are all these email in a file somewhere? Is the file a normal ascci file ? Would the best way be to open it up with file() and then extract the lines with a regex ?

Would appreciate some guidance about which files to use and where to find them

Any more ideas how I should go about this ?

Thanks

Wed, 12/02/2009 - 07:16
andreychek

Well, it kind of sounds as if you could use some bulk email software :-)

Something like Mailman or phpList will do all that for you... adding in opt-out messages, removing addresses that bounced from the contacts list, and so on.

Anytime you receive an email, the message is sitting in a folder within $HOME/Maildir/ until your email client reads it. After that, it all depends on your client. If you're using IMAP, then yeah, the file would remain up there.

If your email client downloaded it, I dunno where it is :-)

However, the files there all one email per file... and you simply want the first occurrence of "From" in each of those files.

If you "cd" into the directory containing all your email, you can type this to get you started:

grep -m 1 '^From'

Which should show the first instance of any line beginning with "From" within each file.

Hopefully that helps you get started!

-Eric

Thu, 12/03/2009 - 04:11
Davvit

Thanks for your reply.

I am using Mozilla Thunderbird to download my emails. So I guess that means that they have been taken off of the server and are on my desktop ... somewhere :(

I have looked in the "thunderbird" directories, but can not find the email files.

Thu, 12/03/2009 - 05:05
Davvit

OK

I have found this directory that was in the Thunderbird settings:

I opened the 6.7 Mb file with note pad. Looks like all the emails are in this one file!

This is on my pc, it is a flat text file not encoded or compressed.

Not sure of the best way to extract the emails addresses. I can find them easily enough - here is an example:

I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to

If you do so, please include this problem report. You can delete your own text from the attached returned message.

               The mail system

accounting@hhhxbilling.com: Host or domain name not found. Name service error

for name=hhhxbilling.com type=A: Host not found

Maybe I should upload the file to my server and process it with php using regex to find "The mail system" up to "<:"

I don't know how I would do it on my pc :(

Is there an easier way ?

Thu, 12/03/2009 - 05:21
Davvit

By the Way -

This file is very useful cos I can see the whole message :)

I can see how the big companies are dealing with their bounces. They use the return address to to get the send information:

Return-Path: bounce-722328-dave=expert-world.com@citius.getresponse.com

See that "dave=expert-world.com" is the to: address just with the "@ "changed to an "=" sign.

Interesting :-)

Thu, 12/03/2009 - 08:18
andreychek

Well, how exactly you extract the email addresses comes down to personal preference :-)

One way isn't necessarily better than the other.

Windows certainly has the tools to allow you to do all that (including using the PHP you mentioned), as well as other options, but that isn't my preferred environment... I'd probably want to use the command line tools on Linux to grab all those ;-)

-Eric

Topic locked