|
@@ -10,6 +10,8 @@ import(
|
|
|
func main() {
|
|
func main() {
|
|
|
|
|
|
|
|
var cfg *ini.File
|
|
var cfg *ini.File
|
|
|
|
|
+ var mymail *ini.Section
|
|
|
|
|
+ var err error
|
|
|
|
|
|
|
|
fmt.Println(len(os.Args))
|
|
fmt.Println(len(os.Args))
|
|
|
if len(os.Args) > 1 && len(os.Args) < 4 {
|
|
if len(os.Args) > 1 && len(os.Args) < 4 {
|
|
@@ -19,13 +21,24 @@ func main() {
|
|
|
|
|
|
|
|
// sezione di prova per vedere cosa ritorna dal file
|
|
// sezione di prova per vedere cosa ritorna dal file
|
|
|
fmt.Println(inip.GetMySection())
|
|
fmt.Println(inip.GetMySection())
|
|
|
- mymail,err := cfg.GetSection("mail")
|
|
|
|
|
|
|
|
|
|
- fmt.Println(mymail,err)
|
|
|
|
|
- } else {
|
|
|
|
|
- fmt.Println("parametro errato")
|
|
|
|
|
- os.Exit(100)
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ mymail,err = cfg.GetSection("mail")
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ fmt.Println("Errore nella lettura della sezione")
|
|
|
|
|
+ fmt.Println(err)
|
|
|
|
|
+ os.Exit(99)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ keys := mymail.KeyStrings()
|
|
|
|
|
+
|
|
|
|
|
+ for _,x := range keys {
|
|
|
|
|
+ fmt.Println(x)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// nota... anziche' cercare le singole chiavi, si puo' generare un for
|
|
|
|
|
+// che sia in grado di scorrere l'elenco delle chiavi e nel caso ne trovi una
|
|
|
|
|
+// che corrisponde, assegnarla alla relativa variabile
|
|
|
|
|
|
|
|
var _from string = "acliservice@altemica.local"
|
|
var _from string = "acliservice@altemica.local"
|
|
|
var _to string = "server@altemica.net"
|
|
var _to string = "server@altemica.net"
|
|
@@ -40,13 +53,12 @@ var _body string ="Acliserver in avvio..."
|
|
|
m.SetHeader("Subject",_subject)
|
|
m.SetHeader("Subject",_subject)
|
|
|
m.SetBody("Text/Text",_body)
|
|
m.SetBody("Text/Text",_body)
|
|
|
|
|
|
|
|
- d := gomail.NewDialer("mail.altemica.net",465,"acliservice@altemica.local","uei551hex")
|
|
|
|
|
|
|
+ d := gomail.NewDialer("localhost",465,"acliservice@altemica.local","uei551hex")
|
|
|
d.SSL=true
|
|
d.SSL=true
|
|
|
//d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
|
|
//d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
|
|
|
|
|
|
|
|
-// Send the email to Bob, Cora and Dan.
|
|
|
|
|
-if err := d.DialAndSend(m); err != nil {
|
|
|
|
|
|
|
+ // Send the email to Bob, Cora and Dan.
|
|
|
|
|
+ if err := d.DialAndSend(m); err != nil {
|
|
|
panic(err)
|
|
panic(err)
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|