mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-01 20:17:35 -04:00 
			
		
		
		
	Updates for mailgun
This commit is contained in:
		
							parent
							
								
									2e51bbd655
								
							
						
					
					
						commit
						41daa63056
					
				| @ -258,9 +258,11 @@ class NinjaMailerJob implements ShouldQueue | ||||
|         switch ($this->nmo->settings->email_sending_method) { | ||||
|             case 'default': | ||||
|                 $this->mailer = config('mail.default'); | ||||
|                 // $this->setHostedMailgunMailer(); //should only be activated if hosted platform needs to fall back to mailgun
 | ||||
|                 break; | ||||
|             case 'mailgun': | ||||
|                 $this->mailer = 'mailgun'; | ||||
|                 $this->setHostedMailgunMailer(); | ||||
|                 break; | ||||
|             case 'gmail': | ||||
|                 $this->mailer = 'gmail'; | ||||
| @ -368,6 +370,21 @@ class NinjaMailerJob implements ShouldQueue | ||||
|         return $user; | ||||
|     } | ||||
| 
 | ||||
|     private function setHostedMailgunMailer() | ||||
|     { | ||||
|          | ||||
|         if (property_exists($this->nmo->settings, 'email_from_name') && strlen($this->nmo->settings->email_from_name) > 1) { | ||||
|             $email_from_name = $this->nmo->settings->email_from_name; | ||||
|         } else { | ||||
|             $email_from_name = $this->company->present()->name(); | ||||
|         } | ||||
| 
 | ||||
|         $this->nmo | ||||
|          ->mailable | ||||
|          ->from(config('services.mailgun.from.address'), $email_from_name); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Configures Mailgun using client supplied secret | ||||
|      * as the Mailer | ||||
|  | ||||
| @ -463,6 +463,21 @@ class Email implements ShouldQueue | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     private function setHostedMailgunMailer() | ||||
|     { | ||||
|          | ||||
|         if (property_exists($this->email_object->settings, 'email_from_name') && strlen($this->email_object->settings->email_from_name) > 1) { | ||||
|             $email_from_name = $this->email_object->settings->email_from_name; | ||||
|         } else { | ||||
|             $email_from_name = $this->company->present()->name(); | ||||
|         } | ||||
| 
 | ||||
|         $this->mailable | ||||
|          ->from(config('services.mailgun.from.address'), $email_from_name); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|      | ||||
|     /** | ||||
|      * Sets the mail driver to use and applies any specific configuration | ||||
|      * the the mailable | ||||
| @ -472,9 +487,11 @@ class Email implements ShouldQueue | ||||
|         switch ($this->email_object->settings->email_sending_method) { | ||||
|             case 'default': | ||||
|                 $this->mailer = config('mail.default'); | ||||
|                 // $this->setHostedMailgunMailer(); //should only be activated if hosted platform needs to fall back to mailgun
 | ||||
|                 break; | ||||
|             case 'mailgun': | ||||
|                 $this->mailer = 'mailgun'; | ||||
|                 $this->setHostedMailgunMailer(); | ||||
|                 break; | ||||
|             case 'gmail': | ||||
|                 $this->mailer = 'gmail'; | ||||
|  | ||||
| @ -24,6 +24,10 @@ return [ | ||||
|         'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), | ||||
|         'webhook_signing_key' => env('MAILGUN_WEBHOOK_SIGNING_KEY', ''), | ||||
|         'scheme' => 'https', | ||||
|         'from' => [ | ||||
|             'address' => env('MAILGUN_FROM_ADDRESS', ''), | ||||
|             'name' => env('MAILGUN_FROM_NAME', ''), | ||||
|         ], | ||||
|     ], | ||||
| 
 | ||||
|     'postmark' => [ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user