1 Star 0 Fork 1

白菜林/email

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
email_attach_ex.go 359 Bytes
Copy Edit Raw Blame History
白菜林 authored 2021-09-30 11:38 . attach_by_url
package email
import (
"mime"
"net/http"
"path/filepath"
)
func (e *Email) AttachFileURL(fileURL string) (a *Attachment, err error) {
resp, err := http.Get(fileURL)
if err != nil {
return
}
defer resp.Body.Close()
ct := mime.TypeByExtension(filepath.Ext(fileURL))
basename := filepath.Base(fileURL)
return e.Attach(resp.Body, basename, ct)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/clin003/email.git
git@gitee.com:clin003/email.git
clin003
email
email
cfbcb09f733f

Search