Skip to content

Commit 227e51b

Browse files
authored
SMTP: Support disabling encryption (ngoduykhanh#297)
1 parent f256668 commit 227e51b

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Note:
6868
| `SMTP_USERNAME` | The SMTP username | N/A |
6969
| `SMTP_PASSWORD` | The SMTP user password | N/A |
7070
| `SMTP_AUTH_TYPE` | The SMTP authentication type. Possible values: `PLAIN`, `LOGIN`, `NONE` | `NONE` |
71-
| `SMTP_ENCRYPTION` | the encryption method. Possible values: `SSL`, `SSLTLS`, `TLS`, `STARTTLS` | `STARTTLS` |
71+
| `SMTP_ENCRYPTION` | the encryption method. Possible values: `NONE`, `SSL`, `SSLTLS`, `TLS`, `STARTTLS` | `STARTTLS` |
7272

7373
### Defaults for server configuration
7474

emailer/smtp.go

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func authType(authType string) mail.AuthType {
3333

3434
func encryptionType(encryptionType string) mail.Encryption {
3535
switch strings.ToUpper(encryptionType) {
36+
case "NONE":
37+
return mail.EncryptionNone
3638
case "SSL":
3739
return mail.EncryptionSSL
3840
case "SSLTLS":

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func init() {
6161
flag.StringVar(&flagSmtpUsername, "smtp-username", util.LookupEnvOrString("SMTP_USERNAME", flagSmtpUsername), "SMTP Username")
6262
flag.StringVar(&flagSmtpPassword, "smtp-password", util.LookupEnvOrString("SMTP_PASSWORD", flagSmtpPassword), "SMTP Password")
6363
flag.BoolVar(&flagSmtpNoTLSCheck, "smtp-no-tls-check", util.LookupEnvOrBool("SMTP_NO_TLS_CHECK", flagSmtpNoTLSCheck), "Disable TLS verification for SMTP. This is potentially dangerous.")
64-
flag.StringVar(&flagSmtpEncryption, "smtp-encryption", util.LookupEnvOrString("SMTP_ENCRYPTION", flagSmtpEncryption), "SMTP Encryption : SSL, SSLTLS, TLS or STARTTLS (by default)")
64+
flag.StringVar(&flagSmtpEncryption, "smtp-encryption", util.LookupEnvOrString("SMTP_ENCRYPTION", flagSmtpEncryption), "SMTP Encryption : NONE, SSL, SSLTLS, TLS or STARTTLS (by default)")
6565
flag.StringVar(&flagSmtpAuthType, "smtp-auth-type", util.LookupEnvOrString("SMTP_AUTH_TYPE", flagSmtpAuthType), "SMTP Auth Type : PLAIN, LOGIN or NONE.")
6666
flag.StringVar(&flagSendgridApiKey, "sendgrid-api-key", util.LookupEnvOrString("SENDGRID_API_KEY", flagSendgridApiKey), "Your sendgrid api key.")
6767
flag.StringVar(&flagEmailFrom, "email-from", util.LookupEnvOrString("EMAIL_FROM_ADDRESS", flagEmailFrom), "'From' email address.")

0 commit comments

Comments
 (0)