我正在尝试使用gmail
golang
个package main
import(
"fmt"
"github.com/SlyMarbo/gmail"
)
func main() {
email := gmail.Compose("Email subject", "Email body")
email.From = "account@gmail.com"
email.Password = "password"
// Defaults to "text/plain; charset=utf-8" if unset.
email.ContentType = "text/html; charset=utf-8"
// Normally you'll only need one of these, but I thought I'd show both.
email.AddRecipient("recepient@domain.com")
err := email.Send()
if err != nil {
fmt.Println(err)
// handle error.
}
}
包在我的本地系统上发送邮件。为此,我尝试了以下内容:
map = %{baz: 4, biz: nil, foo: "bar"}
for {key, value} <- map, !is_nil(value), into: %{}, do: {key, value}
我既没有收到任何错误也没有邮件。不确定是否由于本地服务器而未发送。任何人都可以指导我,我错过了什么?我从this页面参考了。