// NewCustomMailer creates a mailer with the given authentication mechanism.
//
// Example:
//
//	gomail.NewCustomMailer("host:587", smtp.CRAMMD5Auth("username", "secret"))
964404
func NewCustomMailer(addr string, auth smtp.Auth, settings ...MailerSetting) *Mailer {
	// Error is not handled here to preserve backward compatibility
	host, port, _ := net.SplitHostPort(addr)

	m := &Mailer{
		addr: addr,
		host: host,
		auth: auth,
	}

	for _, s := range settings {
		s(m)
	}

	if m.config == nil {
		m.config = &tls.Config{ServerName: host}
	}
	if m.send == nil {
		m.send = m.getSendMailFunc(port == "465")
	}

	return m
}
1328659
func newMailOrchestrator() *mailOrchestrator {
	return &mailOrchestrator{
		mailboxes:        make(map[lnwire.ChannelID]MailBox),
		liveIndex:        make(map[lnwire.ShortChannelID]lnwire.ChannelID),
		unclaimedPackets: make(map[lnwire.ShortChannelID][]*htlcPacket),
	}
}
556379
func NewValidator() *Validator {
	var (
		v   = &Validator{seen: make(map[string]*bytes.Buffer)}
		err error
	)
	fm := template.FuncMap{
		"tabs":             Tabs,
		"slice":            toSlice,
		"oneof":            oneof,
		"constant":         constant,
		"goifyAtt":         GoifyAtt,
		"add":              Add,
		"recurseAttribute": v.recurseAttribute,
	}
	v.arrayValT, err = template.New("array").Funcs(fm).Parse(arrayValTmpl)
	if err != nil {
		panic(err)
	}
	v.hashValT, err = template.New("hash").Funcs(fm).Parse(hashValTmpl)
	if err != nil {
		panic(err)
	}
	v.userValT, err = template.New("user").Funcs(fm).Parse(userValTmpl)
	if err != nil {
		panic(err)
	}
	return v
}
84722
func Create(c *messagebird.Client, originator string, recipients []string, msgParams *Params) (*Message, error) {
	params, err := paramsForMessage(msgParams)
	if err != nil {
		return nil, err
	}

	params.Set("originator", originator)
	params.Set("recipients", strings.Join(recipients, ","))

	mmsMessage := &Message{}
	if err := c.Request(mmsMessage, http.MethodPost, path, params); err != nil {
		return nil, err
	}

	return mmsMessage, nil
}
1198146
func NewVerifyMessageCmd(address, signature, message string) *VerifyMessageCmd {
	return &VerifyMessageCmd{
		Address:   address,
		Signature: signature,
		Message:   message,
	}
}
574215
func NewDomainInvitesEmailExistingUsersDetails(DomainName string, NumRecipients uint64) *DomainInvitesEmailExistingUsersDetails {
	s := new(DomainInvitesEmailExistingUsersDetails)
	s.DomainName = DomainName
	s.NumRecipients = NumRecipients
	return s
}
303033
func (c *Client) NewInitiator(opts *NewInitiatorOptions) (NewInitiatorResult, error) {
	req := xms.PostInitiatorsReq(*opts)
	res, err := c.api.PostInitiators(&req)
	if err != nil {
		return nil, err
	}

	nir := NewInitiatorResult(res)
	return nir, nil
}
806029
func NewEmailVerificationClient(app application.Application) *EmailVerificationClient {
	return &EmailVerificationClient{
		app:          app,
		notification: app.NotificationService(),
	}
}
1063696
func NewURLSigner(authType string, privKey string) *URLSigner {
	return &URLSigner{
		authType: authType,
		privKey:  privKey,
	}
}
1148510
func NewGoMemcacher(c *memcache.Client) *GoMemcacher {
	if c == nil {
		panic("Cannot have nil memcache client")
	}
	return &GoMemcacher{client: c}
}
98665
func NewAuthenticator(statePool *state.StatePool, clock clock.Clock) (*Authenticator, error) {
	authContext, err := newAuthContext(statePool.SystemState(), clock)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &Authenticator{
		statePool:   statePool,
		authContext: authContext,
	}, nil
}
976427
func NewVerifier(opts x509.VerifyOptions, auth authenticator.Request, allowedCommonNames sets.String) authenticator.Request {
	return &Verifier{opts, auth, allowedCommonNames}
}
1132283
func NewMailjetClient(apiKeyPublic, apiKeyPrivate string, baseURL ...string) *Client {
	httpClient := NewHTTPClient(apiKeyPublic, apiKeyPrivate)
	smtpClient := NewSMTPClient(apiKeyPublic, apiKeyPrivate)

	client := &Client{
		httpClient: httpClient,
		smtpClient: smtpClient,
		apiBase:    apiBase,
	}

	if len(baseURL) > 0 {
		client.apiBase = baseURL[0]
	}
	return client
}
37301
func NewCustomPartitioner(options ...HashPartitionerOption) PartitionerConstructor {
	return func(topic string) Partitioner {
		p := new(hashPartitioner)
		p.random = NewRandomPartitioner(topic)
		p.hasher = fnv.New32a()
		p.referenceAbs = false
		for _, option := range options {
			option(p)
		}
		return p
	}
}
1318009
func NewClient(conn net.Conn, host string) (*smtp.Client, error) {
  return smtp.NewClient(conn, host)
}
1203595
func NewPremailer(doc *goquery.Document, options *Options) Premailer {
	pr := premailer{}
	pr.doc = doc
	pr.rules = make([]*styleRule, 0)
	pr.allRules = make([][]*css.CSSRule, 0)
	pr.leftover = make([]*css.CSSRule, 0)
	pr.elements = make(map[string]*elementRules)
	pr.elIdAttr = "pr-el-id"
	if options == nil {
		options = NewOptions()
	}
	pr.options = options
	return &pr
}
673103
func NewPremailerFromBytes(doc []byte, options *Options) (Premailer, error) {
	read := bytes.NewReader(doc)
	d, err := goquery.NewDocumentFromReader(read)
	if err != nil {
		return nil, err
	}
	return NewPremailer(d, options), nil
}