 e9650156bb
			
		
	
	e9650156bb
	
	
	
		
			
			- Fixed loging method in CommonmailController - Fixed mail config file - Fixed attachment variable initalization in MailController - Fixed sendEmail() method in PhpMailController passing empty array as default value for $template_variables - Fixed Bugsnag reported issue for sendmail() which is happening for reports
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Controllers\Common;
 | |
| 
 | |
| use Exception;
 | |
| 
 | |
| class CommonMailer
 | |
| {
 | |
|     public function setSmtpDriver($config)
 | |
|     {
 | |
|         try {
 | |
|             if (!$config) {
 | |
|                 return false;
 | |
|             }
 | |
|             $https = [];
 | |
|             $https['ssl']['verify_peer'] = false;
 | |
|             $https['ssl']['verify_peer_name'] = false;
 | |
|             $transport = new \Swift_SmtpTransport($config['host'], $config['port'], $config['security']);
 | |
|             $transport->setUsername($config['username']);
 | |
|             $transport->setPassword($config['password']);
 | |
|             $transport->setStreamOptions($https);
 | |
|             $set = new \Swift_Mailer($transport);
 | |
| 
 | |
|             // Set the mailer
 | |
|             \Mail::setSwiftMailer($set);
 | |
| 
 | |
|             return true;
 | |
|         } catch (Exception $e) {
 | |
|             loging('mail-config', $e->getMessage());
 | |
| 
 | |
|             return $e->getMessage();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public function setMailGunDriver($config)
 | |
|     {
 | |
|         if (!$config) {
 | |
|             return false;
 | |
|         }
 | |
| 
 | |
|         return true;
 | |
|     }
 | |
| }
 |