// GetDsn Return a correct SMTP DSN.
GetDsn Return a correct SMTP DSN.
// GetDsn Return a correct SMTP DSN .
func (c *smtpConfig) GetDsn() string {
	var buf bytes.Buffer
	if len(c.User) > 0 {
		_, _ = buf.WriteString(c.User)
		if len(c.Pass) > 0 {
			_ = buf.WriteByte(':')
			_, _ = buf.WriteString(c.Pass)
		}
		_ = buf.WriteByte('@')
	}
	_, _ = buf.WriteString(c.Net.string())
	if len(c.Host) > 0 {
		_ = buf.WriteByte('(')
		_, _ = buf.WriteString(c.Host)
		if c.Port > 0 {
			_ = buf.WriteByte(':')
			_, _ = buf.WriteString(fmt.Sprintf("%d", c.Port))
		}
		_ = buf.WriteByte(')')
	}
	_ = buf.WriteByte('/')
	_, _ = buf.WriteString(c.TLS.string())
	var val = &url.Values{}
	if c.ServerName != "" {
		val.Add("ServerName", c.ServerName)
	}
	if c.SkipVerify {
		val.Add("SkipVerify", "true")
	}
	params := val.Encode()
	if len(params) > 2 {
		_, _ = buf.WriteString("?" + params)
	}
	return buf.String()
}
func ( c * smtpConfig ) GetDsn ( ) string { var buf bytes . Buffer if len ( c . User ) > 0 { _ , _ = buf . WriteString ( c . User ) if len ( c . Pass ) > 0 { _ = buf . WriteByte ( ':' ) _ , _ = buf . WriteString ( c . Pass ) } _ = buf . WriteByte ( '@' ) } _ , _ = buf . WriteString ( c . Net . string ( ) ) if len ( c . Host ) > 0 { _ = buf . WriteByte ( '(' ) _ , _ = buf . WriteString ( c . Host ) if c . Port > 0 { _ = buf . WriteByte ( ':' ) _ , _ = buf . WriteString ( fmt . Sprintf ( " " , c . Port ) ) } _ = buf . WriteByte ( ')' ) } _ = buf . WriteByte ( '/' ) _ , _ = buf . WriteString ( c . TLS . string ( ) ) var val = & url . Values { } if c . ServerName != " " { val . Add ( " " , c . ServerName ) } if c . SkipVerify { val . Add ( " " , " " ) } params := val . Encode ( ) if len ( params ) > 2 { _ , _ = buf . WriteString ( " " + params ) } return buf . String ( ) }
GetDsn Return a correct SMTP DSN.
GetDsn Return a correct SMTP DSN .
// [username[:password]@] // [protocol[(address)]] // [username[:password]@] // /tlsmode // [?param1=value1&...&paramN=valueN] // nolint: gomnd