1 回答

TA贡献1799条经验 获得超9个赞
您可以使用“fmt.Sprintf()”。它解决了您的问题。
package main
import (
"bufio"
"fmt"
"log"
"os"
)
func main() {
file, err := os.Open("test.txt")
if err != nil {
log.Fatal(err)
}
var mails []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
mails = append(mails, scanner.Text())
}
sendMails := ""
for _, m := range mails {
sendMails += fmt.Sprintf("%s", m)
}
command := fmt.Sprintf("https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=contact@test.com,&bcc=%s&su=Hello+World!&body=This+Is+Just+An+Example", sendMails)
fmt.Println(mails)
exec.Command("xdg-open", command).Run()
}
- 1 回答
- 0 关注
- 94 浏览
添加回答
举报