I have a project where I send an email using the built-in PHP () function, I just send one email for a small amount of HTML and very limited CSS (two tables and a bit of CSS in my head for styling), but the server seems to be , does it very slowly (so much so that the page to which the administrator sends the message often from time to time)
So my question is: does mail () put a high load on the server (not sure if this is the right term), or is it just that the server I'm using is garbage?
Should I consider projects like http://pear.php.net/package/Mail for this kind of thing?
EDIT:
Here is the code in question:
$query = "SELECT email FROM $a_table WHERE id='$Id'"; $result = mysql_query($query) or die("Query failed: ".mysql_error()); $mail_to = mysql_fetch_row($result); $mail_to = $mail_to[0]; // multiple recipients $to = $mail_to; // subject $subject = 'notification'; // message $message = '<html> <head> <title>title goes here</title> <style type="text/css"> table { border: 1px solid #000;} table tr th { background-color: #d8d8d8; border-bottom: 1px solid #000} table tr th, table tr td { padding: 4px; text-align: center; } </style> </head> <body> <h1>header goes here</h1> <table cellspacing="0"> <tr> <th>th1</th><td>'.$var.'</td> </tr> <tr> <th>th2</th><td>'.$var2.'</td> </tr> <tr> <th>th3</th><td>'.$var3.'</td> </tr> </table> <p> </p> <table cellspacing="0"> <tr> <th colspan="13">Key</th> </tr> <tr> <th>G</th> <th>I</th> <th>L</th> <th>M</th> <th>N</th> <th>O</th> <th>Q</th> <th>R</th> <th>S</th> <th>V</th> <th>W</th> <th>C</th> <th>?</th> </tr> <tr> <td>G</td> <td>I</td> <td>L</td> <td>M</td> <td>U</td> <td>O</td> <td>Q</td> <td>R</td> <td>S</td> <td>V</td> <td>W</td> <td>C</td> <td>R</td> </tr> </table> </body> </html> // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: admin< admin@admin.com >' . "\r\n"; // might need to get rid of this soon // Mail it mail($to, $subject, $message, $headers); }
source share