email

ruby
# app/mailers/user_mailer.rb
class UserMailer < ApplicationMailer
  default from: 'noreply@example.com'

  def welcome_email(user)
    @user = user

ActionMailer advanced patterns for transactional emails

ruby rails action-mailer
by Sarah Mitchell 2 tabs
ruby
module EmailNormalization
  extend ActiveSupport::Concern

  included do
    attr_accessor :soft_warnings

Soft Validation: Normalize + Validate Email

rails activerecord validations
by codesnips 4 tabs
php
<?php

namespace App\Notifications;

use App\Models\Post;
use Illuminate\Bus\Queueable;

Laravel notifications for multi-channel messaging

laravel notifications email
by Carlos Mendez 2 tabs
ruby
class CreateEmailDeliveries < ActiveRecord::Migration[7.1]
  def change
    create_table :email_deliveries do |t|
      t.string :dedupe_key, null: false
      t.string :mailer, null: false
      t.string :action, null: false

Transactional Email “Send Once” with Delivered Marker

rails reliability activerecord
by codesnips 4 tabs
python
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.conf import settings


def send_welcome_email(user):

Django email with HTML templates

django python email
by Priya Sharma 1 tab
go
package mail

import (
  "context"
  "bytes"
  "encoding/json"

Email delivery via HTTP provider with context, timeout, and idempotency

go email background-jobs
by Leah Thompson 1 tab
typescript
import { readFileSync } from 'fs';
import { join } from 'path';
import Handlebars from 'handlebars';
import mjml2html from 'mjml';
import { htmlToText } from 'html-to-text';

Email sending with nodemailer + templates

node email nodemailer
by codesnips 3 tabs
ruby
class RegistrationsController < ApplicationController
  def new
    @user = User.new
  end

  def create

Send a Welcome Email After Signup Using a Sidekiq Background Job in Rails

ruby rails sidekiq
by codesnips 4 tabs
typescript
import { Module } from '@nestjs/common';
import { BullModule } from '@nestjs/bull';
import { ScheduleModule } from '@nestjs/schedule';
import { DigestProducer } from './digest.producer';
import { DigestProcessor } from './digest.processor';

Scheduling and Processing Email Digests with a Bull Queue in NestJS

nestjs bull redis
by codesnips 3 tabs
javascript
const express = require('express');
const { enqueueEmail } = require('./emailQueue');

const router = express.Router();

router.post('/users/:id/welcome-email', async (req, res, next) => {

Reliable Background Email Jobs With BullMQ, Redis, and a Worker Process

bullmq redis background-jobs
by codesnips 3 tabs
python
from django.core.mail import EmailMessage, EmailMultiAlternatives
from django.template.loader import render_to_string
from django.conf import settings
import os

Django email with attachments and templates

django python email
by Priya Sharma 1 tab
ruby
class DeliveryObserver
  def self.delivered_email(message)
    new(message).record
  end

  def initialize(message)

Action Mailer Delivery Observability Hook

rails observability action-mailer
by codesnips 3 tabs