gomail

repository·master·Indexed 26 days ago

https://github.com/go-gomail/gomail

A Go package for sending emails via SMTP servers. Supports attachments, embedded images, HTML/text templates, and SSL/TLS.

Tokens
253
Snippets
2
Records
2
Agent score
39%

What's inside gomail

  1. Bypass x509 certificate verification

    master

    If you encounter the error x509: certificate signed by unknown authority, it means the SMTP server's certificate is not considered valid by the client. You can bypass certificate chain and hostname verification by setting the TLSConfig field on the dialer with InsecureSkipVerify: true.

    Warning: This is insecure and should not be used in production environments.

    package main
    
    import (
    	"crypto/tls"
    
    	"gopkg.in/gomail.v2"
    )
    
    func main() {
    	d := gomail.NewDialer("smtp.example.com", 587, "user", "123456")
    	d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
    
    	// Send emails using d.
    }