summaryrefslogtreecommitdiffstats
path: root/cmd/email.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/email.go')
-rw-r--r--cmd/email.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/cmd/email.go b/cmd/email.go
new file mode 100644
index 0000000..f4306ec
--- /dev/null
+++ b/cmd/email.go
@@ -0,0 +1,45 @@
+package cmd
+
+import (
+ "git.db.org.ai/dborg/internal/formatter"
+ "github.com/spf13/cobra"
+)
+
+var emailCmd = &cobra.Command{
+ Use: "email",
+ Short: "Email verification commands",
+ Long: `Verify email addresses and check deliverability`,
+}
+
+var verifyEmailCmd = &cobra.Command{
+ Use: "verify [email]",
+ Short: "Verify email address",
+ Long: `Performs comprehensive email verification including format validation, MX records check, SMTP verification, and disposable/webmail detection`,
+ Args: cobra.ExactArgs(1),
+ RunE: runVerifyEmail,
+}
+
+func init() {
+ rootCmd.AddCommand(emailCmd)
+ emailCmd.AddCommand(verifyEmailCmd)
+}
+
+func runVerifyEmail(cmd *cobra.Command, args []string) error {
+ email := args[0]
+
+ c, err := newClient()
+ if err != nil {
+ return err
+ }
+
+ response, err := c.VerifyEmail(email)
+ if err != nil {
+ return err
+ }
+
+ if err := checkError(response.Error); err != nil {
+ return err
+ }
+
+ return formatter.FormatEmailResults(response, IsJSONOutput())
+}