File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 4545 '<YOUR_SERVICE_ID>',
4646 '<YOUR_TEMPLATE_ID>',
4747 templateParams,
48- '<YOUR_PUBLIC_KEY>',
48+ const Options(
49+ publicKey: '<YOUR_PUBLIC_KEY>',
50+ privateKey: '<YOUR_PRIVATE_KEY>',
51+ ),
4952 );
5053 print('SUCCESS!');
5154} catch (error) {
5861import package:emailjs/emailjs.dart
5962
6063// set Public Key as global settings
61- EmailJS.init('<YOUR_PUBLIC_KEY>');
64+ EmailJS.init(const Options(
65+ publicKey: '<YOUR_PUBLIC_KEY>',
66+ privateKey: '<YOUR_PRIVATE_KEY>',
67+ ));
6268
6369try {
6470 // send the email without dynamic variables
Original file line number Diff line number Diff line change @@ -38,10 +38,16 @@ class _HomePageState extends State<HomePage> {
3838 'user_email' : 'hi@example.com' ,
3939 'message' : 'Hi' ,
4040 },
41- '<YOUR_PUBLIC_KEY>' ,
41+ const Options (
42+ publicKey: '<YOUR_PUBLIC_KEY>' ,
43+ privateKey: '<YOUR_PRIVATE_KEY>' ,
44+ ),
4245 );
4346 print ('SUCCESS!' );
4447 } catch (error) {
48+ if (error is EmailJSResponseStatus ) {
49+ print ('ERROR... ${error .status }: ${error .text }' )
50+ }
4551 print (error.toString ());
4652 }
4753 }
You can’t perform that action at this time.
0 commit comments