Reputation: 1
I am using go-mail to send mail. I am embedded image in to mail by m.Embed("common/static/img/logo.png") and use this in HTML by
It works fine when running main.go. But when I bould project and execute main.exe I am getting error "The system can not found path specified."
Upvotes: 0
Views: 295
Reputation: 744
There could be multiple problems here.
One is that the file path you've used has platform-specific path separators. Windows uses "\" instead of "/". To write platform-agnostic paths use https://godoc.org/path/filepath#Join
filepath.Join("common", "static", "img", "logo.png")
The other problem, as Yandry Pozo pointed out, is that you might not have packaged up the logo.png file and distributed it with your code. If that is the case, than something like https://github.com/jteeuwen/go-bindata might help.
Upvotes: 0