المشاريع
عرض على GitHub
badoux/checkmail
حول
حزمة Go للتحقق من صحة عناوين البريد الإلكتروني.
الإنتاجية والأتمتةالنمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- ٠
- خلال 15 يومًا
- ٠
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلcheckmail
Golang package for email validation.
- Format (simple regexp, see: https://www.w3.org/TR/html5/forms.html#valid-e-mail-address and https://davidcel.is/posts/stop-validating-email-addresses-with-regex/)
- Valid domain
- Valid user: verify if the user and mailbox really exist
Usage
Install the Checkmail package
go get github.com/badoux/checkmail
1. Format
func main() {
err := checkmail.ValidateFormat("ç$€§/[email protected]")
if err != nil {
fmt.Println(err)
}
}
output: invalid format
2. Domain
func main() {
err := checkmail.ValidateHost("[email protected]")
if err != nil {
fmt.Println(err)
}
}
output: unresolvable host
3. Host and User
If host is valid, requires valid SMTP serverHostName (see to online validator) and serverMailAddress to reverse validation
for prevent SPAN and BOTS.
func main() {
var (
serverHostName = "smtp.myserver.com" // set your SMTP server here
serverMailAddress = "[email protected]" // set your valid mail address here
)
err := checkmail.ValidateHostAndUser(serverHostName, serverMailAddress, "[email protected]")
if smtpErr, ok := err.(checkmail.SmtpError); ok && err != nil {
fmt.Printf("Code: %s, Msg: %s", smtpErr.Code(), smtpErr)
}
}
output: Code: 550, Msg: 550 5.1.1 The email account that you tried to reach does not exist.
License
Checkmail is licensed under the MIT License.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…
