Skip to content

Commit

Permalink
Merge pull request #7 from StevenMaude/avoid-panic-when-no-html
Browse files Browse the repository at this point in the history
Fix panic when no HTML message present
  • Loading branch information
StevenMaude authored Apr 13, 2017
2 parents 4a422b3 + 9c2d7fc commit ce746e6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ func getMail(latestMsg publicMsg, cookies []*http.Cookie) error {
fmt.Println("Subject:", mailMessage.Data.Subject)
fmt.Println("Plain text:")
fmt.Println(mailMessage.Data.Parts[0].Body)
fmt.Println("HTML:")
fmt.Println(mailMessage.Data.Parts[1].Body)

if len(mailMessage.Data.Parts) == 2 {
fmt.Println("HTML:")
fmt.Println(mailMessage.Data.Parts[1].Body)
}

return nil
}

Expand Down

0 comments on commit ce746e6

Please sign in to comment.