File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 1
1
import 'package:flutter/material.dart' ;
2
- import 'package:emailjs/emailjs.dart' ;
2
+ import 'package:emailjs/emailjs.dart' as emailjs ;
3
3
4
4
void main () {
5
5
runApp (const App ());
@@ -31,22 +31,26 @@ class HomePage extends StatefulWidget {
31
31
class _HomePageState extends State <HomePage > {
32
32
void _sendEmail () async {
33
33
try {
34
- await EmailJS .send (
35
- '< YOUR_SERVICE_ID> ' ,
36
- '< YOUR_TEMPLATE_ID> ' ,
34
+ await emailjs .send (
35
+ 'YOUR_SERVICE_ID' ,
36
+ 'YOUR_TEMPLATE_ID' ,
37
37
{
38
- 'user_email ' : '[email protected] ' ,
38
+
39
39
'message' : 'Hi' ,
40
40
},
41
- const Options (
42
- publicKey: '<YOUR_PUBLIC_KEY>' ,
43
- privateKey: '<YOUR_PRIVATE_KEY>' ,
41
+ const emailjs.Options (
42
+ publicKey: 'YOUR_PUBLIC_KEY' ,
43
+ privateKey: 'YOUR_PRIVATE_KEY' ,
44
+ limitRate: const emailjs.LimitRate (
45
+ id: 'app' ,
46
+ throttle: 10000 ,
47
+ )
44
48
),
45
49
);
46
50
print ('SUCCESS!' );
47
51
} catch (error) {
48
- if (error is EmailJSResponseStatus ) {
49
- print ('ERROR... ${ error . status }: ${ error . text } ' );
52
+ if (error is emailjs. EmailJSResponseStatus ) {
53
+ print ('ERROR... $error ' );
50
54
}
51
55
print (error.toString ());
52
56
}
You can’t perform that action at this time.
0 commit comments