title: PHPMailer in a custom php function
body: <p>I made a custom class function for setting up the basic information needed by PHPMailer (so I don't need to input it in everytime). Here is the exact code of the function.</p>
  
  <pre><code>&lt;?php
  
  class PHPMailer {
  
      public static function send() {// I will just add here the addAddress
          require_once 'mail/PHPMailerAutoload.php';
  
          $mail = new PHPMailer;
  
          $mail-&gt;isSMTP();
          $mail-&gt;SMTPDebug = 0;
          $mail-&gt;Debugoutput = 'html';
          $mail-&gt;Host = "smtp.gmail.com";
          $mail-&gt;Port = 587;
          $mail-&gt;SMTPSecure = 'tls';
          $mail-&gt;SMTPAuth = true;
          $mail-&gt;Username = "validusername";
          $mail-&gt;Password = "validpassword";
          $mail-&gt;setFrom('validusername', 'Valid Username');
          $mail-&gt;addAddress('googol8080@gmail.com', 'Googol');
  
          $mail-&gt;Subject = "Subject";
          $mail-&gt;Body    = "&lt;a href=\"www.google.com\"&gt;www.google.com&lt;/a&gt;";
          $mail-&gt;IsHTML(true);
  
          if (!$mail-&gt;send()) {
              return "Error sending message" . $mail-&gt;ErrorInfo;
          } else {
              return "Message sent!";
          }
      }
  }
  </code></pre>
  
  <p>So far it is working on my localhost, but I have questions:</p>
  
  <ul>
  <li>Is this a good practice?</li>
  <li>Is the code okay?</li>
  <li>Is there any drawback/s about this?</li>
  <li>If there is need to optimize here for performance, what do I need to do to make it happen?</li>
  </ul>
  
  <p>I am really new in PHP and PHPMailer any small answers might help me, thanks.</p>