If those black boxes represent Go language code, please share it here by pasting it into the Go Language Playground and then sharing a link in email here.
It is impossible to understand these rectangles on my phone. On Sat, Apr 6, 2019 at 11:10 PM <[email protected]> wrote: > hi, i use this code, I can't make it work help > > Could you tell me how to properly use your library on this code, and set > an example for a custom dealer, so that I can access the smtp through a > proxy (sock4, sock4a, or sock5)? is it possible? please a couple of lines > of code for an example > > func main() { > > > ch := make(chan *gomail.Message, 10) > > // Use the channel in your program to send emails. > m := gomail.NewMessage() > m.SetHeader("From", "[email protected]") > m.SetHeader("To", "[email protected]") > > //m.SetAddressHeader("Cc", "[email protected]", "Dan") > m.SetHeader("Subject", "Hello!") > m.SetBody("text/html", "Hello <b>Bob</b> and <i>Cora</i>!") > //m.Attach("/home/Alex/lolcat.jpg") > > ch <- m > > go func() { > d := gomail.NewDialer("smtp-mail.outlook.com", 587, > "[email protected]", "pwd") > > var s gomail.SendCloser > > var err error > open := false > for { > select { > case m, ok := <-ch: > if !ok { > return > } > if !open { > if s, err = d.Dial(); err != nil { > panic(err) > } > open = true > } > if err := gomail.Send(s, m); err != nil { > log.Print(err) > } > // Close the connection to the SMTP server if no email was sent in > // the last 30 seconds. > case <-time.After(30 * time.Second): > if open { > if err := s.Close(); err != nil { > panic(err) > } > open = false > } > } > } > }() > > } > > > > > // Close the channel to stop the mail daemon. > close(ch) > > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- *Michael T. [email protected] <[email protected]>* -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
