https://play.golang.org/p/lNbxCAxsqwd
here is code On Monday, April 8, 2019 at 3:43:04 AM UTC+3, Michael Jones wrote: > > 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 <axllo...@gmail.com <javascript:>> 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", "ifabio...@mail.bcu.ac.uk <javascript:>") >> m.SetHeader("To", "t...@mail.com") >> >> //m.SetAddressHeader("Cc", "d...@example.com <javascript:>", "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, >> "ifabio...@mail.bcu.ac.uk <javascript:>", "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 golan...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- > > *Michael T. jonesmichae...@gmail.com <javascript:>* > -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.