# easysendmail **Repository Path**: EEPPEE_admin/easysendmail ## Basic Information - **Project Name**: easysendmail - **Description**: easy to use send email go lib - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-24 - **Last Updated**: 2026-01-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: send-email-by-go, Go语言 ## README # a easy lib for sending email by go code # sample usage ## first setup ```bash GOPRIVATE=gitee.com/EEPPEE_admin/easysendmail go get gitee.com/EEPPEE_admin/easysendmail ``` ```golang package main import ( "fmt" "gitee.com/EEPPEE_admin/easysendmail" ) func main() { // 1. 配置 QQ 邮箱 SMTP 信息(替换为你的实际信息) smtpCreds := easysendmail.SMTPCredentials{ SenderEmail: "1690544550@qq.com", SenderKey: "REPLACE WITH YOUR OWN CODE", // QQ 邮箱的 SMTP 授权码(不是登录密码) SMTPServer: "smtp.qq.com", SMTPPort: 465, } // 2. 创建邮件实例(易用性核心:一行创建) email := easysendmail.NewEmail(smtpCreds) // 3. 配置邮件内容(链式调用/分步调用都可以) if err := email.AddRecipient("1876056356@qq.com"); err != nil { // 替换为实际收件人 fmt.Printf("添加收件人失败: %v\n", err) return } if err := email.SetSubject("测试纯 Go 邮件库"); err != nil { fmt.Printf("设置主题失败: %v\n", err) return } if err := email.SetMessageText("这是用纯 Go 邮件库发送的测试邮件,无任何 Cgo 代码!"); err != nil { fmt.Printf("设置正文失败: %v\n", err) return } // make sure ./test.txt is at the same folder // if err := email.AddAttachment("./test.txt"); err != nil { // fmt.Printf("添加附件失败: %v\n", err) // return // } // 可选:调试打印配置 email.DebugPrint() // 4. 发送邮件 if err := email.Send(); err != nil { fmt.Printf("发送邮件失败: %v\n", err) return } fmt.Println("邮件发送成功!") } ``` # idea from my old sendemailX repo - https://gitee.com/EEPPEE_admin/sendemail-x/