Help

Script integrations

Want to send or receive emails from Gmail, Outlook, or Yahoo in your app — without having to handle OAuth? Auth-Email lets you do exactly that, by acting as an OAuth proxy that translates IMAP/SMTP/POP into password-based access for OAuth-secured accounts.

This guide shows how to integrate Auth-Email into your web app using common languages and libraries:

  • ✅  Node.js (Nodemailer)
  • ✅  Python (smtplib, imaplib)
  • ✅  PHP (PHPMailer, native sockets)

What you need

Before you begin:

  1. Add an account to Auth-Email via the dashboard.
  2. Make sure you save the password you set for the account.
  3. All of the following examples assume you are using an Outlook account. Refer to the Auth-Email dashboard for server and port settings our our setup guides to see details for your own account.

Send from Node.js with Nodemailer

First install Nodemailer:

npm install nodemailer

Then, use the following code to send an email via Auth-Email:

const nodemailer = require("nodemailer");

const transporter = nodemailer.createTransport({
  host: "outlook.auth-email.com",
  port: 465,
  secure: true,
  auth: {
    user: "[email protected]",
    pass: "your-chosen-password"
  }
});

transporter.sendMail({
  from: '"You" <[email protected]>',
  to: "[email protected]",
  subject: "Hello from Node.js",
  text: "This email was sent via Auth-Email + OAuth!"
}, (err, info) => {
  if (err) {
    return console.error("Error sending mail:", err);
  }
  console.log("Message sent:", info.response);
});

Send and receive using Python

Python makes SMTP easy out of the box with smtplib. To read email via IMAP, use imaplib.

Sending Email (SMTP):

import smtplib

smtp_server = "outlook.auth-email.com"
smtp_port = 465
email = "[email protected]"
password = "your-chosen-password"

with smtplib.SMTP_SSL(smtp_server, smtp_port) as server:
    server.login(email, password)
    message = "Subject: Hello from Python\n\nThis email was sent via Auth-Email + OAuth!"
    server.sendmail(email, "[email protected]", message)
    print("Message sent!")
import imaplib

imap_server = "outlook.auth-email.com"
email = "[email protected]"
password = "your-chosen-password"

mail = imaplib.IMAP4_SSL(imap_server)
mail.login(email, password)
mail.select("inbox")
status, messages = mail.search(None, "ALL")

print("Message IDs:", messages[0].split())

Send from PHP using PHPMailer

First, install PHPMailer via Composer:

composer require phpmailer/phpmailer

Then, use the following code to send an email via Auth-Email:

<?php
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';

$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'outlook.auth-email.com';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;

$mail->Username = '[email protected]';
$mail->Password = 'your-chosen-password';

$mail->setFrom('[email protected]', 'You');
$mail->addAddress('[email protected]');
$mail->Subject = 'Hello from PHP';
$mail->Body = 'This message was sent via Auth-Email + OAuth!';

if (!$mail->send()) {
    echo 'Error sending mail: ' . $mail->ErrorInfo;
} else {
    echo 'Message sent!';
}
?>

Best practices

  • Never hardcode passwords. Use environment variables or a secure vault.
  • Use TLS/SSL for all connections (ports 993, 995, 465).
  • Log in only when needed; avoid persistent connections unless required.

Test your setup

Once configured:

  • Send a test email to confirm SMTP works
  • Connect to IMAP/POP and verify message retrieval
  • Look at the “Last active” display in the Auth-Email dashboard to check activity

Troubleshooting

  • "Login failed" — ensure the token/password is copied exactly, and the protocol you are using is enabled in your Auth-Email dashboard
  • "TLS required" — Check you're using the correct port & encryption. We have a separate guide for server and port settings, including those that require STARTTLS.
  • "Connection refused" — Likely a firewall issue or port misconfiguration. Alternatively, if your plan includes the Legacy TLS feature, enable this and try again.

See our troubleshooting guide for more tips and FAQ.