Skip to content

Releases: devzeeh/barcodemail

v1.0.2 Exit release (Final unstable)

30 Oct 23:36
f88d710

Choose a tag to compare

What's Changed

Full Changelog: v1.0.1...v1.0.2

v1.0.1

03 Sep 03:32
160ece4

Choose a tag to compare

Release v1.0.1 Release Note

Note: This project is developed primarily for personal use and learning purposes.
Support is limited, so use at your own discretion. Contributions, suggestions, and improvements are welcome.

Features

  • Introduced the barcodemail package with:
    • Qrcode() — Generates a QR code (random 4-digit data like "QRcode1234"), saves it as qrcode.png, and returns the filename.
    • Filepath() — Creates a file given a filename and returns its *os.File pointer.
  • Added email subpackage to handle email sending, including embedding QR codes inline via Content-ID (CID).

Supported in v1.0.0

  • Generate QR codes with random 4-digit content (QRcode{XXXX})
  • Save QR codes as PNG files (qrcode.png)
  • Embed QR codes inline in HTML emails using CID
  • Send emails via SMTP using GoMail

Import the repository

import (
    "github.com/devzeeh/barcodemail"
    "github.com/devzeeh/barcodemail/email"
)

Installation

go get github.com/devzeeh/barcodemail@v1.0.1

Usage Example

package main

import (
	"fmt"

	"github.com/devzeeh/barcodemail"
	"github.com/devzeeh/barcodemail/email"
)

func main() {
	// Set sender details
	email.SenderEmail("sender@test.com") // Your email address
	email.SenderPassword("ABCD EF12 3456") // Use app password for Gmail
	email.SenderName("Devzeeh")

	data, file := barcodemail.Qrcode()
	contentID := email.QrEmbed("QRCODE") // Content-ID for the embedded image

	// HTML email body with embedded QR code
	body := fmt.Sprintf(`
		<!DOCTYPE html>
		<html>
		<body style="font-family: Arial, sans-serif;">
			<h2>Hello</h2>
			<p>Here are your codes: %s</p>
			<img src="cid:%s" alt="QR Code" style="border:1px solid #ddd; padding:5px;">
			<p>Thank you,<br></p>
		</body>
		</html>
	`, data, contentID)

        // Prepare email data
	sendData := email.MailData{
		From: "user@test.com",
		Subject: "Barcodemail",
		Body:    body,
		Qrcode:  file,
		Cid:     contentID,
	}

        // Send the email
	email.Mail(sendData)
}

Requirements

Go version 1.22 or newer
SMTP-enabled email account (e.g., Gmail, Outlook)

Improvements

Default output file: qrcode.png
Consistent random QR content (QRcode{4digit})

On the Horizon

Potential features for upcoming versions:

  • Ability to customize QR code content and styling
  • Support for barcodes (e.g., code128)
  • Enhanced email templating and alternative sending options
  • In-memory QR rendering (no file creation needed)

What's Changed

  • retract v1.0.0 and v0.1.1-beta.2 by @devzeeh in #11
  • Fix variable naming in MailData struct and update references in email handling by @zeehcode in #12

Full Changelog: v0.1.0-beta.1...v1.0.1

v0.1.0-beta.1

02 Sep 06:35
a8b0ce6

Choose a tag to compare

v0.1.0-beta.1 Pre-release
Pre-release

Release v0.1.0-beta.1 (Beta Release Version)

Note: This project is developed primarily for personal use and learning purposes.
Support is limited, so use at your own discretion. Contributions, suggestions, and improvements are welcome.

Features

  • Introduced the barcodemail package with:
    • Qrcode() — Generates a QR code (random 4-digit data like "QRcode1234"), saves it as qrcode.png, and returns the filename.
    • Filepath() — Creates a file given a filename and returns its *os.File pointer.
  • Added email subpackage to handle email sending, including embedding QR codes inline via Content-ID (CID).

Supported in v1.0.0

  • Generate QR codes with random 4-digit content (QRcode{XXXX})
  • Save QR codes as PNG files (qrcode.png)
  • Embed QR codes inline in HTML emails using CID
  • Send emails via SMTP using GoMail

Usage Example

qrFile := barcodemail.Qrcode()
cid := email.QrEmbed(qrFile)

htmlBody := fmt.Sprintf(`
  <h2>Hello</h2>
  <p>Your code:</p>
  <img src="cid:%s" alt="QR Code">`, cid)

sendData := email.MailData{
  ToEmail: "user@example.com",
  Subject: "Your Subject",
  Body:    htmlBody,
  Qrcode:  qrFile,
  Cid:     cid,
}

email.Mail(sendData)

Requirements

Go version 1.22 or newer
SMTP-enabled email account (e.g., Gmail, Outlook)

Improvements

Default output file: qrcode.png
Consistent random QR content (QRcode{4digit})

On the Horizon

Potential features for upcoming versions:

  • Ability to customize QR code content and styling
  • Support for barcodes (e.g., code128)
  • Enhanced email templating and alternative sending options
  • In-memory QR rendering (no file creation needed)

What's Changed

  • Update README.md by @devzeeh in #6
  • Enhance package documentation for barcodemail and email packages by @zeehcode in #7
  • Add initial implementation of barcodemail functionality with QR code generation by @zeehcode in #8
  • Refactor QR code generation logic and clean up unused code by @zeehcode in #9
  • Add documentation for random number generator used in barcode and QR code generation by @zeehcode in #10

Full Changelog: https://github.com/devzeeh/barcodemail/commits/v0.1.0-beta.1