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", "ifabion.bai...@mail.bcu.ac.uk")
   m.SetHeader("To", "t...@mail.com")

   //m.SetAddressHeader("Cc", "d...@example.com", "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, 
"ifabion.bai...@mail.bcu.ac.uk", "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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to