Skip to content

Commit

Permalink
Added pretty warnings to the utility to add user interactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
047pegasus committed Jan 29, 2023
1 parent 13e8872 commit 62ec48a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,30 @@ func main() {
Short: "A command line utility to verify and validate email addresses developed using Go with Cobra and Viper.",
Run: func(cmd *cobra.Command, args []string) {
if checkFormat && !isValidFormat(email) {
color.Red("Invalid email format ❌")
color.Red("Invalid email format ❌")
return
}
if checkHost && !isValidHost(email) {
color.Red("Invalid host ❌")
color.Red("❗ Invalid host ❌")
color.Yellow("Try using an email address using a proper host 🔰")
return
}

if checkMX && !isValidMX(email) {
color.Red("Invalid MX record ❌")
color.Red("❗ Invalid MX record ❌")
color.Yellow("Try using an email address using a proper host 🔰")
return
}

if checkDMARC && !isValidDMARC(email) {
color.Red("Invalid DMARC record ❌")
color.Red("❗ Invalid DMARC record ❌")
color.Yellow("Try using an email address using a proper host 🔰")
return
}

if checkSPF && !isValidSPF(email) {
color.Red("Invalid SPF record ❌")
color.Red("❗ Invalid SPF record ❌")
color.Yellow("Try using an email address using a proper host 🔰")
return
}

Expand Down

0 comments on commit 62ec48a

Please sign in to comment.