@@ -32,16 +32,20 @@ export class EmailStack {
3232 encryption : s3 . BucketEncryption . S3_MANAGED ,
3333 lifecycleRules : [
3434 {
35- id : '24h ' ,
35+ id : 'Intelligent transition for Incoming ' ,
3636 enabled : true ,
37- expiration : Duration . days ( 1 ) ,
38- noncurrentVersionExpiration : Duration . days ( 1 ) ,
39- prefix : 'today/' ,
37+ prefix : 'incoming/' ,
38+ transitions : [
39+ {
40+ storageClass : s3 . StorageClass . INTELLIGENT_TIERING ,
41+ transitionAfter : Duration . days ( 0 ) ,
42+ } ,
43+ ] ,
4044 } ,
4145 {
42- id : 'Intelligent transition for Inbox ' ,
46+ id : 'Intelligent transition for Sent ' ,
4347 enabled : true ,
44- prefix : 'inbox /' ,
48+ prefix : 'sent /' ,
4549 transitions : [
4650 {
4751 storageClass : s3 . StorageClass . INTELLIGENT_TIERING ,
@@ -50,16 +54,39 @@ export class EmailStack {
5054 ] ,
5155 } ,
5256 {
53- id : 'Intelligent transition for Sent ' ,
57+ id : 'Intelligent transition for Archive ' ,
5458 enabled : true ,
55- prefix : 'sent /' ,
59+ prefix : 'archive /' ,
5660 transitions : [
5761 {
5862 storageClass : s3 . StorageClass . INTELLIGENT_TIERING ,
5963 transitionAfter : Duration . days ( 0 ) ,
6064 } ,
6165 ] ,
6266 } ,
67+ {
68+ id : 'Intelligent transition for Drafts' ,
69+ enabled : true ,
70+ prefix : 'drafts/' ,
71+ transitions : [
72+ {
73+ storageClass : s3 . StorageClass . INTELLIGENT_TIERING ,
74+ transitionAfter : Duration . days ( 0 ) ,
75+ } ,
76+ ] ,
77+ } ,
78+ {
79+ id : 'Auto-delete Trash after 30 days' ,
80+ enabled : true ,
81+ prefix : 'trash/' ,
82+ expiration : Duration . days ( 30 ) ,
83+ } ,
84+ {
85+ id : 'Auto-delete Junk after 7 days' ,
86+ enabled : true ,
87+ prefix : 'junk/' ,
88+ expiration : Duration . days ( 7 ) ,
89+ } ,
6390 ] ,
6491 } )
6592
@@ -102,7 +129,7 @@ export class EmailStack {
102129 {
103130 s3Action : {
104131 bucketName : this . emailBucket . bucketName ,
105- objectKeyPrefix : 'tmp/email_in/' ,
132+ objectKeyPrefix : 'incoming/' , // IMAP server reads from this prefix
106133 } ,
107134 } ,
108135 ] ,
@@ -330,7 +357,7 @@ export class EmailStack {
330357 this . emailBucket . addEventNotification (
331358 s3 . EventType . OBJECT_CREATED_PUT ,
332359 new s3n . LambdaDestination ( lambdaEmailInbound ) ,
333- { prefix : 'tmp/email_in /' } ,
360+ { prefix : 'incoming /' } ,
334361 )
335362 this . emailBucket . addEventNotification (
336363 s3 . EventType . OBJECT_CREATED_PUT ,
@@ -345,12 +372,12 @@ export class EmailStack {
345372 this . emailBucket . addEventNotification (
346373 s3 . EventType . OBJECT_CREATED_COPY ,
347374 new s3n . LambdaDestination ( lambdaEmailConverter ) ,
348- { prefix : 'inbox /' } ,
375+ { prefix : 'incoming /' } ,
349376 )
350377 this . emailBucket . addEventNotification (
351378 s3 . EventType . OBJECT_CREATED_COPY ,
352379 new s3n . LambdaDestination ( lambdaEmailConverter ) ,
353- { prefix : 'today /' } ,
380+ { prefix : 'archive /' } ,
354381 )
355382 }
356383}
0 commit comments