Hi,
Weird that such a simple task can slow down your web server...
$total = mysql_result(mysql_query("SELECT COUNT(email) FROM $tablename"),0);
Simply use mysql_num_rows to get the number of rows returned by your last query : $exist = mysql_query("SELECT * FROM $tablename");
$exist = mysql_fetch_array($exist);
???
Check out the manual to know more about that function, you need to use it in a loop, like a while :
while ($email = mysql_fetch_array($exist))
Moreover what do you mean by "exist" ? I think a name like "emails" would be much more explicit.
$existingemail = $exist['email'];
You shoud directly use the $exist variable, storing it in a temporary variable is useless and slows down your script.
I don't really understand the end of your script but a newsletter only sends mails to registered users. So the idea is to create a list of e-mails and to send a message, the newsletter, to each subscribed users...
I hope it helps,
JM