Loading src/Form/MailSettingsForm.php +0 −2 Original line number Diff line number Diff line Loading @@ -5,9 +5,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\file\Entity\File; use Symfony\Component\DependencyInjection\ContainerInterface; /** Loading src/Plugin/Mail/GraphMail.php +9 −16 Original line number Diff line number Diff line Loading @@ -2,25 +2,18 @@ namespace Drupal\graph_mail\Plugin\Mail; use Drupal\Core\Asset\AssetResolverInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ImmutableConfig; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\ConfigFormBaseTrait; use Drupal\Core\Logger\LoggerChannelTrait; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Logger\RfcLogLevel; use Drupal\Core\Mail\MailInterface; use Drupal\Core\Mail\MailManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\Theme\ThemeManagerInterface; use Drupal\Core\Utility\Error; use GuzzleHttp\ClientInterface; use Microsoft\Graph\Graph; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** Loading Loading @@ -169,21 +162,21 @@ public function mail(array $message) { 'subject' => $message['subject'], 'body' => [ 'contentType' => 'HTML', 'content' => is_string($message['body']) ? $message['body'] : $message['body'][0] 'content' => is_string($message['body']) ? $message['body'] : $message['body'][0], ], 'from' => [ 'emailAddress' => [ 'address' => $config->get('default_mail') ?? $this->config('system.site')->get('mail') ] 'address' => $config->get('default_mail') ?? $this->config('system.site')->get('mail'), ], ], 'toRecipients' => [ [ 'emailAddress' => [ 'address' => $message['to'] ] ] ] ] 'address' => $message['to'], ], ], ], ], ]; if (isset($message['params']['files'])) { Loading @@ -194,7 +187,7 @@ public function mail(array $message) { $mail_body['message']['attachments'][] = [ '@odata.type' => '#microsoft.graph.fileAttachment', 'name' => $file->get('filename')->value, 'contentBytes' => base64_encode($file_data) 'contentBytes' => base64_encode($file_data), ]; } } Loading Loading
src/Form/MailSettingsForm.php +0 −2 Original line number Diff line number Diff line Loading @@ -5,9 +5,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\file\Entity\File; use Symfony\Component\DependencyInjection\ContainerInterface; /** Loading
src/Plugin/Mail/GraphMail.php +9 −16 Original line number Diff line number Diff line Loading @@ -2,25 +2,18 @@ namespace Drupal\graph_mail\Plugin\Mail; use Drupal\Core\Asset\AssetResolverInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ImmutableConfig; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\ConfigFormBaseTrait; use Drupal\Core\Logger\LoggerChannelTrait; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Logger\RfcLogLevel; use Drupal\Core\Mail\MailInterface; use Drupal\Core\Mail\MailManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\Theme\ThemeManagerInterface; use Drupal\Core\Utility\Error; use GuzzleHttp\ClientInterface; use Microsoft\Graph\Graph; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** Loading Loading @@ -169,21 +162,21 @@ public function mail(array $message) { 'subject' => $message['subject'], 'body' => [ 'contentType' => 'HTML', 'content' => is_string($message['body']) ? $message['body'] : $message['body'][0] 'content' => is_string($message['body']) ? $message['body'] : $message['body'][0], ], 'from' => [ 'emailAddress' => [ 'address' => $config->get('default_mail') ?? $this->config('system.site')->get('mail') ] 'address' => $config->get('default_mail') ?? $this->config('system.site')->get('mail'), ], ], 'toRecipients' => [ [ 'emailAddress' => [ 'address' => $message['to'] ] ] ] ] 'address' => $message['to'], ], ], ], ], ]; if (isset($message['params']['files'])) { Loading @@ -194,7 +187,7 @@ public function mail(array $message) { $mail_body['message']['attachments'][] = [ '@odata.type' => '#microsoft.graph.fileAttachment', 'name' => $file->get('filename')->value, 'contentBytes' => base64_encode($file_data) 'contentBytes' => base64_encode($file_data), ]; } } Loading