@@ -40,7 +40,7 @@ public static function config(string $code, bool $failOnMissing = true): string|
40
40
return self ::$ config [$ code ]['value ' ];
41
41
}
42
42
43
- public static function mail (string $ to_name , string $ to_email , string $ subject , $ html , $ data = false )
43
+ public static function mail (string $ to_name , string $ to_email , string $ subject , $ html , $ data = false ): ? int
44
44
{
45
45
$ sendgrid_api_key = self ::config ('sendgrid_api_key ' , true );
46
46
$ sendgrid_sender_email = self ::config ('sendgrid_sender_email ' , true );
@@ -60,22 +60,16 @@ public static function mail(string $to_name, string $to_email, string $subject,
60
60
}
61
61
}
62
62
63
- // if ($data != false) {
64
- // // HTML is a Twig template with data
65
- // if(!site::$page->twig)
66
- // {
67
- // site::$page->getTwig();
68
- // }
69
- // $html = site::$page->twig->render($html, $data);
70
- // }
71
63
$ email ->addContent ('text/html ' , $ html );
72
64
$ sendgrid = new \SendGrid ($ sendgrid_api_key );
73
65
try {
74
66
$ response = $ sendgrid ->send ($ email );
75
67
76
68
return $ response ->statusCode ();
77
69
} catch (\Exception $ e ) {
78
- echo 'Caught exception: ' .$ e ->getMessage ()."\n" ;
70
+ Log::error ('Caught exception: ' .$ e ->getMessage ());
71
+
72
+ return null ;
79
73
}
80
74
}
81
75
0 commit comments