func (s *SMTPWriter) WriteMsg(when time.Time, msg string, level int) error {
	if level > s.Level {
		return nil
	}

	hp := strings.Split(s.Host, ":")

	// Set up authentication information.
	auth := s.getSMTPAuth(hp[0])

	// Connect to the server, authenticate, set the sender and recipient,
	// and send the email all in one step.
	contentType := "Content-Type: text/plain" + "; charset=UTF-8"
	mailmsg := []byte("To: " + strings.Join(s.RecipientAddresses, ";") + "\r\nFrom: " + s.FromAddress + "<" + s.FromAddress +
		">\r\nSubject: " + s.Subject + "\r\n" + contentType + "\r\n\r\n" + fmt.Sprintf(".%s", when.Format("2006-01-02 15:04:05")) + msg)

	return s.sendMail(s.Host, auth, s.FromAddress, s.RecipientAddresses, mailmsg)
}
// WriteMsg write message in smtp writer.
// it will send an email with subject and only this message.
WriteMsg write message in smtp writer.
it will send an email with subject and only this message.
// WriteMsg write message in smtp writer . // it will send an email with subject and only this message .
func (s *SMTPWriter) WriteMsg(when time.Time, msg string, level int) error {
	if level > s.Level {
		return nil
	}
	hp := strings.Split(s.Host, ":")
	auth := s.getSMTPAuth(hp[0])
	contentType := "Content-Type: text/plain" + "; charset=UTF-8"
	mailmsg := []byte("To: " + strings.Join(s.RecipientAddresses, ";") + "\r\nFrom: " + s.FromAddress + "<" + s.FromAddress +
		">\r\nSubject: " + s.Subject + "\r\n" + contentType + "\r\n\r\n" + fmt.Sprintf(".%s", when.Format("2006-01-02 15:04:05")) + msg)
	return s.sendMail(s.Host, auth, s.FromAddress, s.RecipientAddresses, mailmsg)
}
func ( s * SMTPWriter ) WriteMsg ( when time . Time , msg string , level int ) error { if level > s . Level { return nil } hp := strings . Split ( s . Host , " " ) auth := s . getSMTPAuth ( hp [ 0 ] ) contentType := " " + " " mailmsg := [ ] byte ( " " + strings . Join ( s . RecipientAddresses , " " ) + " \r \n " + s . FromAddress + " " + s . FromAddress + " \r \n " + s . Subject + " \r \n " + contentType + " \r \n \r \n " + fmt . Sprintf ( " " , when . Format ( " " ) ) + msg ) return s . sendMail ( s . Host , auth , s . FromAddress , s . RecipientAddresses , mailmsg ) }
WriteMsg write message in smtp writer.
WriteMsg write message in smtp writer .
// Set up authentication information. // Connect to the server, authenticate, set the sender and recipient, // and send the email all in one step.