Categorygithub.com/reneepc/gopher-lite-mailer
repositorypackage
0.0.0-20240730233902-663b455fa889
Repository: https://github.com/reneepc/gopher-lite-mailer.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

Golang SP Logo

Gopher Lite Mailer



📝 Table of Contents

📕 WHY

This program is designed to help the GolangSP meetup organization to efficiently send emails to participants regarding meetup confirmations, coupons, takeaways, news, and more.

This CLI tool allows you to customize email templates, include CSS styling, add signature images, customize e-mail headers, and include attachments.

🚀 Instalation

Clone the repository and build the application:

git clone https://github.com/reneepc/gopher-lite-mailer.git
cd gopher-lite-mailer
go build -o gopher-lite-mailer

🎈 Usage

The basic usage of the application is as follows:

./gopher-lite-mailer [options] <email> <password>

| The email and password are the credentials that are going to be used to send the emails.

By default it is going to use the templates directory as its source for email templates. This can be changed by using the -dir flag.

The templates are composed basically of two files: template.html and data.csv. The first is a Go template/html file that is going to be used to generate the email body. The second is a CSV file that contains the data that is going to be used to fill the template. The file names can be changed using the flags: -template and -data.

The values extracted from the CSV file must have the {{.Data.Field}} structure. The {{.Data}} is necessary to avoid conflicts with the safe templates of CSS and signature.

The CSV file should have the following structure:

Email,Field1,Field2,Field3,...
[email protected],Value1,Value2,Value3,...
...

| The presence of the headers is obligatory.

Subject

You can specify the email subject using the -subject flag. By default, it will use an empty string.

CSS

It's possible to customize the style of the email using the tag <style>{{.Css}}</style> in the html email template. By default, it will read the file styles.css in the assets directory. This can be changed using the -css flag.

Signature

It's also possible to include a signature image in the email footer. By default, it will get the Golang SP Logo from the internet. This can be changed using the -signature flag, passing a link to a new image.

Attachments

📧 Getting Gmail App Password

To send emails using the Gmail SMTP server, it is necessary to generate an app password. To do so, follow the steps below:

  1. Logged on your Google account, go to the App Passwords page.
  2. You will be prompted to log in again.
  3. Just fill the name of the app (e.g. Gopher Lite Mailer) and click on the "Create" button.
  4. A password will be generated. COPY IT! You won't be able to see it again.