here's a possibility, ..
use a popup window to run your mail script, .. then when the mail is finished generating, .. execute an auto-close script.
i found this code. it would be cool to display an animated gif as a progress bar while it is happening. it's just a theory here.
index.php
<html>
<head>
<script language="javascript">
<!--
function ShowMenu(URL, WinTitle, WinWidth, WinHeight, WinLeft, WinTop){
attr = "resizable=no,width=" + WinWidth + ",height=" + WinHeight + ",screenX=" + WinLeft + ",screenY=" + WinTop + ",left=" + WinLeft + ",top=" + WinTop + "";
msgWindow=open(URL, WinTitle, attr);
if (msgWindow.opener == null) msgWindow.opener = self;
}
//-->
</script>
</head>
<body>
<a href="javascript:ShowMenu('popup.php','window1',160,100,2,95)">Click Here to send newsletter</a>
</body>
</html>
popup.php
<?
function sendNewsLetter()
{
// all the mail code goes here
return 1
}
if(sendNewsLetter())
{
echo "<html>
<head>
<script language=\"javascript\">
<!--
function ShowMenu(URL, WinTitle, WinWidth, WinHeight, WinLeft, WinTop){
attr = \"resizable=no,width=\" + WinWidth + \",height=\" + WinHeight + \",screenX=\" + WinLeft + \",screenY=\" + WinTop + \",left=\" + WinLeft + \",top=\" + WinTop + \"\";
msgWindow=open(URL, WinTitle, attr);
if (msgWindow.opener == null) msgWindow.opener = self;
}
//-->
</script>
</head>
<body>";
}
else
{
echo "failed";
}
<a href="javascript:ShowMenu('popup.html','window1',160,100,2,95)">Click Here</a>
</body>
</html>