I have a function for email, please find the code below:
function sendEmail($userName, $password, $sendTo, $sendToName, $subject, $body, $mailSent){
$mail = new PHPMailer();
// $body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
--------
--------
--------
$mail->SetFrom($userName, 'Rajendra Arora');
$mail->AddReplyTo($userName,"Rajendra Arora");
$mail->Subject = $subject;
$mail->Body = $body; // optional, comment out and test
}
This email function has an attachment with long file size but whenever this email function is called by using sendEmail();
. It is executed everytime and takes much time as it has to go through the whole execution program with primarily upload.
Is there any way to execute this sendEmail()
function only for once time. So that we could call it simply once and saves time from preventing to upload?