code: func (email *Email) Log(e log.Entry) {
  	email.rw.RLock()
  
  	if !email.enabled {
  		email.rw.RUnlock()
  		return
  	}
  
  	email.once.Do(func() {
  		email.formatter = email.formatFunc(email)
  	})
  
  	d := gomail.NewDialer(email.host, email.port, email.username, email.password)
  
  	email.rw.RUnlock()
  
  	var s gomail.SendCloser
  	var err error
  	var open bool
  	var alreadyTriedSending bool
  	var message *gomail.Message
  	var count uint8
  
  	for {
  		count = 0
  		alreadyTriedSending = false
  		message = email.formatter(e)
  
  	REOPEN:
  		// check if SMTP connection open
  		if !open {
  			count++
  			if s, err = d.Dial(); err != nil {
  				log.WithField("error", err).Warn("ERROR connection to smtp server")
  
  				if count == 3 {
  					break
  				}
  				goto REOPEN
  			}
  			count = 0
  			open = true
  		}
  
  	RESEND:
  		count++
  		if err = gomail.Send(s, message); err != nil {
  
  			log.WithField("error", err).Warn("ERROR sending to smtp server, retrying")
  
  			if count == 3 && !alreadyTriedSending {
  				// maybe we got disconnected...
  				alreadyTriedSending = true
  				open = false
  				_ = s.Close()
  				goto REOPEN
  			} else if alreadyTriedSending {
  				// we reopened and tried 2 more times, can't say we didn't try
  				log.WithField("error", err).Alert("ERROR sending log via EMAIL, RETRY and REOPEN failed")
  				break
  			}
  			goto RESEND
  		}
  		break
  	}
  }
docs: // Log handles the log entry