File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,6 @@ fn render_template(
59
59
EMAIL_ENV . get_template ( template_name) ?. render ( context)
60
60
}
61
61
62
- pub trait Email {
63
- fn subject ( & self ) -> String ;
64
- fn body ( & self ) -> String ;
65
- }
66
-
67
62
#[ derive( Debug , Clone ) ]
68
63
pub struct EmailMessage {
69
64
pub subject : String ,
@@ -82,16 +77,6 @@ impl EmailMessage {
82
77
}
83
78
}
84
79
85
- impl Email for EmailMessage {
86
- fn subject ( & self ) -> String {
87
- self . subject . clone ( )
88
- }
89
-
90
- fn body ( & self ) -> String {
91
- self . body_text . clone ( )
92
- }
93
- }
94
-
95
80
#[ derive( Debug , Clone ) ]
96
81
pub struct Emails {
97
82
backend : EmailBackend ,
@@ -192,8 +177,8 @@ impl Emails {
192
177
Ok ( message)
193
178
}
194
179
195
- pub async fn send < E : Email > ( & self , recipient : & str , email : E ) -> Result < ( ) , EmailError > {
196
- let email = self . build_message ( recipient, email. subject ( ) , email. body ( ) ) ?;
180
+ pub async fn send ( & self , recipient : & str , email : EmailMessage ) -> Result < ( ) , EmailError > {
181
+ let email = self . build_message ( recipient, email. subject , email. body_text ) ?;
197
182
198
183
self . backend
199
184
. send ( email)
You can’t perform that action at this time.
0 commit comments