I am trying to make a bot which sends mails. I got the following code. I am wondering, if it's possible to place the mails
slice into this field seperated by a ,
?
&bcc=
If my test.txt contains
test1@mail.com
test2@mail.com
I'd like the part of the link to contain &bcc=test1@mail.com,test2@mail.com
Is this doable with Go?
package main
import (
"bufio"
"fmt"
"log"
"os"
"os/exec"
)
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())
}
fmt.Println(mails)
exec.Command("xdg-open", "https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=contact@test.com,&bcc=test1@mail.com,test2@mail.com&su=Hello+World!&body=This+Is+Just+An+Example").Run()
}