// From sets the sender email address.
//
// Users should also consider setting FromName().
430757
func (m *MailYak) From(addr string) {
	m.fromAddr = m.trimRegex.ReplaceAllString(addr, "")
}
340075
func (m *MailYak) FromName(name string) {
	m.fromName = mime.QEncoding.Encode("UTF-8", m.trimRegex.ReplaceAllString(name, ""))
}
717376
func (s Service) SendEmailWithHeaders(from string, to []string, subject string, body string, headers map[string][]string) error {
	m := mail.NewMessage()
	m.SetHeaders(headers)
	m.SetHeader("From", from)
	m.SetHeader("To", to...)
	m.SetHeader("Subject", subject)
	m.SetBody("text/plain", body)

	d := mail.NewPlainDialer(
		s.SMTPHost,
		s.SMTPPort,
		s.SMTPUsername,
		s.SMTPPassword,
	)
	d.LocalName = s.SMTPIdentity
	if s.SMTPSkipVerify {
		d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
	}
	return d.DialAndSend(m)
}
460590
func from(req *http.Request) string {
	if f := req.Header.Get("X-Forwarded-For"); f != "" {
		return f
	}
	f := req.RemoteAddr
	ip, _, err := net.SplitHostPort(f)
	if err != nil {
		return f
	}
	return ip
}
1191558
func (tx *Transaction) To() *common.Address {
	if tx.data.Recipient == nil {
		return nil
	}
	to := *tx.data.Recipient
	return &to
}
891436
func (transition *EventTransition) From(states ...string) *EventTransition {
	transition.froms = states
	return transition
}
834041
func From(other generic.T) T {
	switch other.Size() {
	case 2:
		return T{other.Get(0, 0), other.Get(0, 1), 0}
	case 3, 4:
		return T{other.Get(0, 0), other.Get(0, 1), other.Get(0, 2)}
	default:
		panic("Unsupported type")
	}
}
296014
func From(data []uint64, k uint) *BloomFilter {
	m := uint(len(data) * 64)
	return &BloomFilter{m, k, bitset.From(data)}
}
1354693
func from(b *Builder, args []string, attributes map[string]bool, flagArgs []string, original string) error {
	switch {
	case len(args) == 1:
	case len(args) == 3 && len(args[0]) > 0 && strings.EqualFold(args[1], "as") && len(args[2]) > 0:

	default:
		return fmt.Errorf("FROM requires either one argument, or three: FROM <source> [as <name>]")
	}

	name := args[0]

	// Support ARG before from
	argStrs := []string{}
	for n, v := range b.Args {
		argStrs = append(argStrs, n+"="+v)
	}
	var err error
	if name, err = ProcessWord(name, argStrs); err != nil {
		return err
	}

	// Windows cannot support a container with no base image.
	if name == NoBaseImageSpecifier {
		if runtime.GOOS == "windows" {
			return fmt.Errorf("Windows does not support FROM scratch")
		}
	}
	b.RunConfig.Image = name
	// TODO: handle onbuild
	return nil
}
973340
func (lock *UserPostUserLock) Sender() (user *User) {
	user, _ = NewUser(lock.From)
	return
}
1154829
func (g *UndirectedGraph) From(n graph.Node) []graph.Node {
	if !g.Has(n) {
		return nil
	}

	nodes := make([]graph.Node, g.edges[n.ID()].Len())
	i := 0
	g.edges[n.ID()].Visit(func(neighbor int, edge graph.Edge) {
		nodes[i] = g.nodes[neighbor]
		i++
	})

	return nodes
}
793427
func (l Log) From(log Log) Log {
	for key, val := range log {
		l[key] = val
	}
	return l
}
1116072
func (s Service) SendEmail(from string, to []string, subject string, body string) error {
	return s.SendEmailWithHeaders(from, to, subject, body, nil)
}
1154595
func (s *UserIdentityInfo) SetEmail(v string) *UserIdentityInfo {
	s.Email = &v
	return s
}
1256564
func (lock *ProjectPostUserLock) Sender() (user *User) {
	user, _ = NewUser(lock.From)
	return
}
1261396
func (t *Transition) From(from uint8) *Transition {
	t.from = from
	t.fromSet = true
	t.recalculate()
	return t
}
908090
func (c SMTPConfig) FromAddress() string {
	if c.Alias != "" {
		return fmt.Sprintf(`"%s" <%s>`, c.Alias, c.From)
	}
	return fmt.Sprintf("<%s>", c.From)
}