Advertisement
Guest User

Reaproveitando código para não repetir em todos métodos

a guest
May 22nd, 2017
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. public function enviar_notificacao(){
  2.    
  3.     $mailconf = $this->setup_mail();
  4.  
  5.     $mailconf->isHTML(true);
  6.     $mailconf->Subject = 'Here is the subject';
  7.     $mailconf->Body    = 'This is the HTML message body <b>in bold!</b>';
  8. }
  9.  
  10. private function setup_mail(){
  11.  
  12.     $mail = new PHPMailer;
  13.     $mail->isSMTP();                                      
  14.     $mail->Host = 'smtp1.example.com;smtp2.example.com';  
  15.     $mail->SMTPAuth = true;                              
  16.     $mail->Username = 'user@example.com';                
  17.     $mail->Password = 'secret';                          
  18.     $mail->SMTPSecure = 'tls';                            
  19.     $mail->Port = 587;  
  20.  
  21.     return $mail;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement