根据html提取资源链接
This commit is contained in:
@@ -15,42 +15,6 @@ import (
|
||||
// 1. 支持文本
|
||||
// 2. 支持文件
|
||||
|
||||
func simple_test() {
|
||||
// mail_driver := "smtp"
|
||||
// mail_host := "smtpdm-ap-southeast-1.aliyun.com"
|
||||
// mail_port := ""
|
||||
// mail_username := ""
|
||||
// mail_password := ""
|
||||
// mail_From_address := ""
|
||||
// mail_from_name := ""
|
||||
// mail_reply_to := ""
|
||||
|
||||
// user := "tech@email.blueoceantech.co"
|
||||
// password := "SupporT2017"
|
||||
// host := "smtpdm-ap-southeast-1.aliyun.com"
|
||||
// port := "80" // 80或smtp
|
||||
// auth := smtp.PlainAuth("", user, password, host)
|
||||
// toEmial := []string{
|
||||
// "995116474@qq.com",
|
||||
// "yun@blueoceanpay.com",
|
||||
// }
|
||||
// // split := strings.Split()
|
||||
// emailHeader := "Header"
|
||||
// subject := "邮件的主题"
|
||||
// contentType := "Content-Type: text/html; charset=UTF-8"
|
||||
// // contentType := "Content-Type: text/plain; charset=UTF-8"
|
||||
// body := `<html><body> <h1>黄新云</h1> <span>666</span></body></html>`
|
||||
// msg := []byte(contentType + "\r\nTo: " + strings.Join(toEmial, ",") + "\r\nFrom: " + emailHeader + "<" + user + ">\r\nSubject: " + subject + "\r\nBcc: yun@blueoceanpay.com \r\nReply-To: yun@blueoceanpay.com" + "\r\n\r\n" + body)
|
||||
// err := smtp.SendMail(host+":"+port, auth, user, toEmial, msg)
|
||||
// fmt.Println(err)
|
||||
|
||||
}
|
||||
|
||||
// type Mail interface {
|
||||
// Auth()
|
||||
// Send(message Message) error
|
||||
// }
|
||||
|
||||
type Mailx struct {
|
||||
user string
|
||||
password string
|
||||
@@ -66,7 +30,7 @@ type Attachment struct {
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
// Form string
|
||||
Form string
|
||||
To []string
|
||||
Cc []string
|
||||
Bcc []string
|
||||
@@ -173,9 +137,13 @@ func (m *Mailx) Send(message Message) error {
|
||||
buffer.WriteString(newBuf.String())
|
||||
}
|
||||
|
||||
if message.Form == "" {
|
||||
message.Form = m.user
|
||||
}
|
||||
|
||||
buffer.WriteString("\r\n--" + boundary + "--\r\n")
|
||||
b := buffer.Bytes()
|
||||
err := smtp.SendMail(m.host+":"+m.port, m.auth, m.user, message.To, b)
|
||||
err := smtp.SendMail(m.host+":"+m.port, m.auth, message.Form, message.To, b)
|
||||
fmt.Println("发送结束:", err)
|
||||
fmt.Println(string(b))
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user