Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get encrypted function #19

Closed
hb0730 opened this issue Dec 22, 2020 · 7 comments
Closed

Get encrypted function #19

hb0730 opened this issue Dec 22, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@hb0730
Copy link

hb0730 commented Dec 22, 2020

Please provide a function that can get the encryption, For example: SMTP = > encryption TLS

const (
	// EncryptionNone uses no encryption when sending email
	EncryptionNone encryption = iota
	// EncryptionSSL sets encryption type to SSL when sending email
	EncryptionSSL
	// EncryptionTLS sets encryption type to TLS when sending email
	EncryptionTLS
)
@xhit xhit added the enhancement New feature or request label Dec 22, 2020
xhit added a commit that referenced this issue Dec 22, 2020
Also, export the String method associated to Encryption Type

For #19
@xhit
Copy link
Owner

xhit commented Dec 22, 2020

Please see commit 31bc89d and let me know. Thanks.

@hb0730
Copy link
Author

hb0730 commented Dec 23, 2020

Yes, we can mail.Encryption (1) , Maybe we can get it based on specific parameters.example:

var encryptionTypesMap = map[string]Encryption{
	"None":     EncryptionNone,
	"SSL/TLS":  EncryptionSSL,
	"STARTTLS": EncryptionTLS,
}

func GetEncryption(str string) Encryption {
	return encryptionTypesMap[str]
}

It's just an idea, and users can do it themselves

@xhit
Copy link
Owner

xhit commented Dec 23, 2020

I prefer users make this type of functions. A package should returns an error when key not exists or have a default value for that keys.

An error need to be checked, and default values can give unintended behaviors.

Use enum can avoid have to analyze this package and focus in developer code in those cases.

Maybe I'm wrong. I'm here to learn, and add a new function is not a breaking change. Feel free to add a PR with your idea.

@weidongbcn
Copy link

with outlook I got Mail Error: SMTP Connection timed out.....

@xhit
Copy link
Owner

xhit commented Apr 5, 2021

@weidongbcn please create another issue with encryption type and port used.

@xhit
Copy link
Owner

xhit commented Nov 18, 2021

It's time to V3 so make all your ideas here: #53

@hb0730
Copy link
Author

hb0730 commented Dec 15, 2021

now I'll close issues

@hb0730 hb0730 closed this as completed Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants