@@ -20,6 +20,10 @@ import (
2020// email body.
2121const PopUnsafeHTML = "POP_UNSAFE_HTML"
2222
23+ // PopPlaintext control whether the message should be sent in plaintext.
24+ // Boolean, default `false`
25+ const PopPlaintext = "POP_PLAINTEXT"
26+
2327// ResendAPIKey is the environment variable that enables Resend as a delivery
2428// method and uses it to send the email.
2529const ResendAPIKey = "RESEND_API_KEY" //nolint:gosec
5660 bcc []string
5761 subject string
5862 body string
63+ plaintext bool
5964 attachments []string
6065 preview bool
6166 unsafe bool
@@ -119,7 +124,7 @@ var rootCmd = &cobra.Command{
119124 var err error
120125 switch deliveryMethod {
121126 case SMTP :
122- err = sendSMTPEmail (to , cc , bcc , from , subject , body , attachments )
127+ err = sendSMTPEmail (to , cc , bcc , from , subject , body , plaintext , attachments )
123128 case Resend :
124129 err = sendResendEmail (to , cc , bcc , from , subject , body , attachments )
125130 default :
@@ -201,6 +206,8 @@ func init() {
201206 rootCmd .Flags ().StringSliceVarP (& attachments , "attach" , "a" , []string {}, "Email's attachments" )
202207 rootCmd .Flags ().StringSliceVarP (& to , "to" , "t" , []string {}, "Recipients" )
203208 rootCmd .Flags ().StringVarP (& body , "body" , "b" , "" , "Email's contents" )
209+ envPlaintext := os .Getenv (PopPlaintext ) == "true"
210+ rootCmd .Flags ().BoolVar (& plaintext , "plaintext" , envPlaintext , "Whether to send email in plaintext" )
204211 envFrom := os .Getenv (PopFrom )
205212 rootCmd .Flags ().StringVarP (& from , "from" , "f" , envFrom , "Email's sender" + commentStyle .Render ("($" + PopFrom + ")" ))
206213 rootCmd .Flags ().StringVarP (& subject , "subject" , "s" , "" , "Email's subject" )
0 commit comments