Closed cescoferraro closed 8 years ago
What's inside the Docker container? You should try doing something like apt-get install -y ca-certificates
if it is an Ubuntu / Debian container.
It is not an issue specific to Gomail, it is an issue with your Docker image. Just look on Google: https://github.com/docker/docker/issues/3825 https://github.com/docker/docker/issues/5157 https://github.com/zenazn/goji/issues/126 http://blog.cloud66.com/x509-error-when-using-https-inside-a-docker-container/
@alexcesaro its a busybox container. WIll dig into busybox ca-certificates now
thanks
FROM progrium/busybox
RUN opkg-install ca-certificates
Still not able to send email inside a kubernetes cluster. It works inside a container on my computer. Its so weird! @alexcesaro
What error do you get?
None, e-mails just do not get sended Any chance my digital ocean nodes Ips are black listed by Google? Is there a way To check it out? Ive had some issues like this with Java on heroku.
go SendRegisterEmail(r, user)
SendApiResponse(w, http.StatusOK, true, "User Added")
}
func SendRegisterEmail(r *http.Request, user models.Users) {
m := gomail.NewMessage()
m.SetHeader("From", "arduinodocesco@gmail.com")
m.SetHeader("To", user.Email)
m.SetHeader("Subject", "Hello!")
body , _ := bcrypt.GenerateFromPassword([]byte(user.Email), bcrypt.MinCost)
pathinho := "api/confirm/" + string(body)
u, _ := url.Parse("http://" + string(r.Host))
u.Path = path.Join(u.Path, pathinho)
s := u.String()
fmt.Println(s)
m.SetBody("text/html", s)
d := gomail.NewDialer("smtp.gmail.com", 587, "arduinodocesco", "mypassword")
if err := d.DialAndSend(m); err != nil {
panic(err)
fmt.Println("inside the error")
}
fmt.Println("after all")
}
2016-04-11T12:27:36.853629184Z 10.100.13.4 - - [11/Apr/2016:12:27:36 +0000] "POST /api/register HTTP/1.0" 200 78
2016-04-11T12:27:36.872609688Z http://templatego.cescoferraro.xyz/api/confirm/$2a$04$DovdcQpiEVT8Zq.TaNHqYuiOwRhP3.phyigIBMXEvGjf.zTTfRZsO
Does it prints "after all"? You should try removing the go
on the first line to help debugging.
it does not. Just tried without the gouroutine and I got the same result, expect that now I do not emit a response because the SendRegisterEmail stucks. "After all" does not get printed. It hangs on the DialAndSend call.
It looks like a network error. You should first make sure that you can reach "smtp.gmail.com" from your container.
like ping? is there a specific command I could use to do that?
You could use telnet
, do some searches on the web.
dialandsend return an error when inside a privileged docker container When inside a kubernetes, the error does not seem to happen, but the email do not get sended.