Sending Email GUI Client- Fyne Golang Coding Tutorial


You need to install the following package:

go get

Let create UI. We need the following widgets


Two labels widgets are required

  • App Heading/Title
  • Showing Error & Success Message


Four Entry widgets are required

  • Sender email
  • Receiver email
  • Email Subject
  • Message/Email body

Button for sending the email.

  • create a button widget and label it Send email

Sending Email GUI Client – Part #1

Sending Email GUI Client – Part # 2


Source Code

 package main 
 import ( 
     gomail "" 
 func main() { 
     a := app.New() 
     w := a.NewWindow("Email Sender Client") 
     // lets create UI for all fields 
     title := canvas.NewText("Email Sender Client..", color.Black) 
     title.TextSize = 22 // font size is increased 
     title.Alignment = fyne.TextAlignCenter 
     message_status := widget.NewLabel("Enter / fill all fields") 
     sender := widget.NewEntry() 
     sender.SetPlaceHolder("Enter Sender Email") 
     receiver := widget.NewEntry() 
     receiver.SetPlaceHolder("Enter Receiver Email") 
     subject := widget.NewEntry() 
     subject.SetPlaceHolder("Enter Subject") 
     message_body := widget.NewMultiLineEntry() 
     message_body.SetPlaceHolder("Enter Message...") 
     // create our first button 
     send_btn := widget.NewButton("Send Email", func() { 
         message := gomail.NewMessage() 
         // message from/ sender email 
         // remove all static values 
         message.SetHeader("From", sender.Text) 
         message.SetHeader("To", receiver.Text) 
         message.SetHeader("Subject", subject.Text) 
         message.SetBody("text/plain", message_body.Text) 
         // put/type smtp client email host(server),port, username,password 
         // you can use gmail and any other server. 
         dailer := gomail.NewDialer("", 587, "[email protected]", "wvVgD2Ut47TjkiOX") 
         err := dailer.DialAndSend(message) 
         if err != nil { 
             // message/ error in message status 
             message_status.Text = err.Error() 
         } else { 
             fmt.Println("Mail Sent successfully...") 
             // message/ error in message status 
             message_status.Text = "Mail Sent successfully..." 
     w.Resize(fyne.NewSize(400, 400)) 
     // send all entries in container 
         title, // title should be centered 



Fyne GoLang GUI Course

Tony BB

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: