-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add mail component #178
Conversation
6d95520
to
d56e48a
Compare
application/email/v0/read_emails.go
Outdated
|
||
func initIMAPClient(serverAddress string, serverPort int) (*imapclient.Client, error) { | ||
|
||
c, err := imapclient.DialTLS(serverAddress+":"+strconv.Itoa(serverPort), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use fmt.Printf
here
application/email/v0/read_emails.go
Outdated
} | ||
} | ||
|
||
func includeSearchCondition(email Email, search Search) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about rename this to checkEnvelopeCondition
?
application/email/v0/read_emails.go
Outdated
return true | ||
} | ||
|
||
func includeSearchMessage(email Email, search Search) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about rename this to checkMessageCondition
?
"title": "Search Subject", | ||
"type": "string" | ||
}, | ||
"search-from-email": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
search-from-email
looks a little bit weird to me. How about we use search-from
or search-email-from
instead?
@@ -0,0 +1,471 @@ | |||
{ | |||
"$defs": { | |||
"search-subject-text": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinks search-subject
should be enough.
application/email/v0/read_emails.go
Outdated
} | ||
} | ||
if search.SearchFromEmail != "" { | ||
if !strings.Contains(email.From, search.SearchFromEmail) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we perform an exact search here: email.From == search.SearchFromEmail
. If the email address is [email protected]
but you search for [email protected]
, things will go wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My original design was to let the users able to search [email protected]
through aaa
.
But, I think your way will be better! So, I will modify it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in this case, fuzzy search it not suitable.
application/email/v0/read_emails.go
Outdated
return emails, nil | ||
} | ||
|
||
func convertMailboxString(mailbox string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you convert the name of mailbox to the Gmail name. Does this mean that the current implementation can only be used with Gmail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@donch1989
I miss to consider this point when I developed it. Thanks for pointing it out.
Now, I have 2 ideas for this.
- do not support mailbox field, and we fetch all emails from all mailbox.
- make mailbox as plain text, and we write the Gmail input as the example in Email Component Document
What do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can go with option 1 first. Will that have any side effects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will that have any side effects?
It will take a longer time to scan all mailboxes.
For AI SDR demo, I think the speed of fetching emails & accuracy of the content would be the key to success.
By specifying the mailbox, it can increase the performance in terms of speed and accuracy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we go with option 2 in the current phase?
Is only searching one mailbox a damage for UX? If so, how about we set it as array:string?
Or, do you have other concerns that I miss?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will take a longer time to scan all mailboxes.
I'm not sure about the mechanism here. I remember you already set a limit on the number of emails, right?
array:string
I don't think array: string can work well on Console for now.
The problem with Option 2 is that users may struggle to type the correct mailbox name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the mechanism here. I remember you already set a limit on the number of emails, right?
Yes, the limit I set is the number to "scan", it will only scan a specific mailbox if the limit is smaller than the message number in a mailbox.
By the current design, it won't get the content for AI SDR usage if we make it scan INBOX first.
The purpose I specially design mailbox field is for the usage to get the sending mails specifically.
The problem with Option 2 is that users may struggle to type the correct mailbox name.
Yes, it is the purpose to design this field with enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the limit I set is the number to "scan",
The reason of this design is that I have not found how to fetch emails through batch (query) way.
So, we have to fetch email one by one .
It makes the scanning takes time if we do not have limit here.
So, I added this field and set it 100 as default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I just check the imap package, it need the mailbox input. Then I think we can use Option 2 with a string plaintext.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I will add Gmail mailbox in the document as well.
"title": "Search To", | ||
"type": "string" | ||
}, | ||
"server-address": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking we should put the server-address
and server-port
into setup.json
. They should be in the same place as the user email and password.
"type": "string" | ||
} | ||
}, | ||
"TASK_SEND_EMAILS": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we only send one email, how about removing the "s"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought an email is like a message to a recipient.
The emails mean a message to several recipients.
I set it as recipients
So, I use plural here.
Should I change it to singular?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Send emails' sounds more like sending different content, but in this case, you're sending just one.
For App Password, please follow the steps below: | ||
- 1. Please Sign in to your Google Account with link: https://myaccount.google.com/apppasswords | ||
- 2. Create a new App Password and save it in a secure place. | ||
- 3. Set it in Secrets in the Instill Platform. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 3. Set it in Secrets in the Instill Platform. | |
- 3. Add App Password as a new secret in the Instill Platform by navigating to **Console** > **Settings** > **Secrets**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (from a doc perspective)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Because
This commit