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 45
45
'<YOUR_SERVICE_ID>',
46
46
'<YOUR_TEMPLATE_ID>',
47
47
templateParams,
48
- '<YOUR_PUBLIC_KEY>',
48
+ const Options(
49
+ publicKey: '<YOUR_PUBLIC_KEY>',
50
+ privateKey: '<YOUR_PRIVATE_KEY>',
51
+ ),
49
52
);
50
53
print('SUCCESS!');
51
54
} catch (error) {
58
61
import package:emailjs/emailjs.dart
59
62
60
63
// 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
+ ));
62
68
63
69
try {
64
70
// 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> {
38
38
'user_email' : '[email protected] ' ,
39
39
'message' : 'Hi' ,
40
40
},
41
- '<YOUR_PUBLIC_KEY>' ,
41
+ const Options (
42
+ publicKey: '<YOUR_PUBLIC_KEY>' ,
43
+ privateKey: '<YOUR_PRIVATE_KEY>' ,
44
+ ),
42
45
);
43
46
print ('SUCCESS!' );
44
47
} catch (error) {
48
+ if (error is EmailJSResponseStatus ) {
49
+ print ('ERROR... ${error .status }: ${error .text }' )
50
+ }
45
51
print (error.toString ());
46
52
}
47
53
}
You can’t perform that action at this time.
0 commit comments