parseArgs (scripts/smtp.js)

wesight · SKILLs/imap-smtp-email/scripts/smtp.js · javascript · MIT
email

Send emails via SMTP with attachments, HTML, and multiple recipients using environment-configured credentials.

#!/usr/bin/env node
// Source: https://github.com/freestylefly/wesight | License: MIT | Copyright 2026 WeSight
// Provided via justclaw.it.com; keep this notice with the code.

/**
 * SMTP Email CLI
 * Send email via SMTP protocol. Works with Gmail, Outlook, 163.com, and any standard SMTP server.
 * Supports attachments, HTML content, and multiple recipients.
 */

const nodemailer = require('nodemailer');
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });

// Parse command-line arguments
function parseArgs() {
  const args = process.argv.slice(2);
  const command = args[0];
  const options = {};
  const positional = [];

  for (let i = 1; i < args.length; i++) {
    const arg = args[i];
    if (arg.startsWith('--')) {
      const key = arg

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key