A HREF MAILTO ONCLICK CLOSE WINDOW

function enter_complete()
{
alert("Email has been sent.");
window.close();
return true;
}
<a href= "mailto: $mailto & $subject & $body" >E-Mail Customers </a>

<a href= "mailto: $mailto&subject&body" onClick="enter_complete()">E-Mail Customers </a>

The first link works creating the email.
The second link does not create the email, but does close the window.

I have tried adding a delay, but that makes no difference.

How do I create this to launch the email and then close the window instead of just closing the window?

Thank you

Joe


Source: stackoverflow-php