Skip to main content

Validate SMTP

Validates an email address by connecting to the mail server via SMTP and verifying the mailbox actually exists. This is the most thorough validation method, providing the highest accuracy by performing real-time verification with the destination mail server.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Input

  • Configuration Id - Configuration ID from the Configuration node. This ID references the validation configuration with SMTP settings.

  • Email Address - Email address to validate via SMTP connection. The validator will connect to the mail server and verify this specific mailbox exists.

Output

  • Result - Validation result object containing success status and SMTP verification details. The structure depends on the "Is Valid" option.

    When "Is Valid" is disabled (default), returns full result object:

    {
    "Success": true,
    "Email": "user@example.com",
    "ValidationType": "smtp",
    "Domain": "example.com",
    "MailServers": [
    {
    "Host": "mail.example.com",
    "Priority": 10,
    "IpAddress": "1.2.3.4"
    }
    ],
    "SmtpDebug": [
    {
    "MailHost": "mail.example.com",
    "PortOpened": true,
    "Connection": true,
    "Errors": null
    }
    ],
    "Configuration": {...}
    }

    When "Is Valid" is enabled, returns simplified result:

    {
    "IsValid": true
    }

Options

  • Is Valid - When enabled, returns only the IsValid boolean instead of the full result object. Default: false.
    • Disabled - Returns complete validation result with SMTP connection details
    • Enabled - Returns only {"IsValid": true} or {"IsValid": false}

How It Works

The Validate SMTP node performs comprehensive real-time verification:

  1. Retrieves the Configuration ID and email address
  2. Performs DNS MX record lookup for the domain
  3. Connects to the mail server(s) via SMTP
  4. Initiates SMTP conversation using verifier email
  5. Executes RCPT TO command to verify mailbox exists
  6. Analyzes server response codes
  7. Returns detailed validation result

This validation process:

  • Makes actual SMTP connections to mail servers
  • Verifies the specific mailbox exists
  • Does not send any email
  • Provides highest accuracy validation
  • Slowest validation method (network-dependent)
  • May be detected by mail servers

SMTP Validation Flow

1. DNS MX Lookup → Find mail servers
2. SMTP Connect → Open connection to mail server
3. EHLO/HELO → Identify as email sender
4. MAIL FROM → Specify verifier email
5. RCPT TO → Verify recipient mailbox
6. Analyze Response → Check if mailbox exists
7. QUIT → Close connection

When to Use SMTP Validation

Best For:

  • High-value email verification (user registration, payments)
  • Verifying specific mailbox existence
  • Reducing hard bounces in email campaigns
  • Lead quality verification
  • Real-time email validation at point of entry
  • Critical business communications
  • Fraud prevention

Not Suitable For:

  • High-volume bulk validation (too slow)
  • Quick format checking (use Regex)
  • Situations where SMTP connections are blocked
  • Networks with port 25 restrictions
  • Services using aggressive anti-spam measures

Limitations:

  • Some mail servers block verification attempts
  • Catch-all domains return false positives
  • Greylisting can cause temporary failures
  • May trigger spam filters with high volume
  • Slower than other validation methods

Usage Examples

Basic SMTP Validation

// Set configuration ID from Configuration node
msg.con_id = msg.configId;

// Email to validate
msg.emailAddress = "john.doe@example.com";

// After Validate SMTP node
const result = msg.result;

if (result.Success) {
console.log("Mailbox exists and can receive email");
console.log("SMTP verification successful");
msg.emailVerified = true;
} else {
console.log("Mailbox does not exist or cannot be verified");
msg.emailVerified = false;

// Check SMTP debug info for details
if (result.SmtpDebug) {
console.log("SMTP Debug:", result.SmtpDebug);
}
}

High-Value User Registration

// User submits registration form
msg.userEmail = "newuser@example.com";
msg.con_id = msg.configId;
msg.emailAddress = msg.userEmail;

// After Validate SMTP node
if (msg.result.Success) {
console.log("Email verified via SMTP");

// Proceed with account creation
msg.createAccount = true;
msg.emailStatus = "verified";

} else {
console.log("SMTP validation failed");

// Check if it's a temporary failure
const smtpDebug = msg.result.SmtpDebug;
const hasConnectionError = smtpDebug.some(debug =>
debug.Errors && debug.Errors.length > 0
);

if (hasConnectionError) {
msg.errorMessage = "Unable to verify email. Please try again later.";
} else {
msg.errorMessage = "This email address does not exist. Please check and try again.";
}

msg.createAccount = false;
}

Multi-Stage Validation Pipeline

// Stage 1: Regex validation (fast)
msg.con_id = msg.configId;
msg.emailAddress = msg.userEmail;

// After Validate Regex node
if (!msg.result.Success) {
msg.validationStatus = "invalid_format";
msg.validationMessage = "Invalid email format";
return;
}

// Stage 2: MX Blacklist validation (fast, security)
// After Validate MX Blacklist node
if (!msg.result.Success) {
msg.validationStatus = "blacklisted";
msg.validationMessage = "Disposable email not allowed";
return;
}

// Stage 3: MX validation (medium speed, domain check)
// After Validate MX node
if (!msg.result.Success) {
msg.validationStatus = "no_mx_records";
msg.validationMessage = "Domain cannot receive email";
return;
}

// Stage 4: SMTP validation (slow, highest accuracy)
// After Validate SMTP node
if (!msg.result.Success) {
msg.validationStatus = "mailbox_not_found";
msg.validationMessage = "Email address does not exist";
return;
}

msg.validationStatus = "verified";
msg.validationMessage = "Email verified successfully";
console.log("Email passed all validation stages");

Batch Validation with Error Handling

// List of important emails to verify
const emails = [
"customer1@example.com",
"customer2@example.com",
"customer3@example.com"
];

const verified = [];
const failed = [];
const errors = [];

for (const email of emails) {
msg.emailToCheck = email;

try {
// Validate SMTP node processes here
// (use Loop node and Try-Catch in actual workflow)

if (msg.result.Success) {
verified.push(email);
} else {
failed.push({
email: email,
reason: "mailbox_not_found",
debug: msg.result.SmtpDebug
});
}

} catch (error) {
errors.push({
email: email,
error: error.message
});
}

// Rate limiting: wait 1 second between validations
// to avoid being flagged as spam
await sleep(1000);
}

console.log("Verified:", verified.length);
console.log("Failed:", failed.length);
console.log("Errors:", errors.length);

msg.verifiedEmails = verified;
msg.failedEmails = failed;

Using SMTP Safe Check Mode

// In Configuration node
// Smtp Safe Check: true (enabled)

// This mode:
// - Uses less aggressive verification
// - Reduces risk of being flagged
// - May have lower accuracy
// - Better for high-volume validation

msg.con_id = msg.configId;
msg.emailAddress = msg.userEmail;

// After Validate SMTP node
if (msg.result.Success) {
console.log("Email verified (safe mode)");
}

Handling SMTP Errors and Retries

msg.con_id = msg.configId;
msg.emailAddress = msg.userEmail;

let attempts = 0;
let maxAttempts = 3;
let validated = false;

while (attempts < maxAttempts && !validated) {
attempts++;

// Validate SMTP node processes here

if (msg.result.Success) {
console.log("Validation successful on attempt", attempts);
validated = true;
break;
}

// Check for temporary errors
const smtpDebug = msg.result.SmtpDebug;
const hasTemporaryError = smtpDebug.some(debug =>
debug.Errors && debug.Errors.some(err =>
err.includes("timeout") || err.includes("temporary")
)
);

if (hasTemporaryError && attempts < maxAttempts) {
console.log("Temporary error, retrying...");
await sleep(2000 * attempts); // Exponential backoff
} else {
console.log("Validation failed permanently");
break;
}
}

msg.validationAttempts = attempts;
msg.validationSuccess = validated;

Lead Scoring with SMTP Verification

msg.con_id = msg.configId;
msg.emailAddress = msg.leadEmail;

// Initialize lead score
let leadScore = 0;

// After Validate SMTP node
const result = msg.result;

if (result.Success) {
// Email exists - high quality lead
leadScore += 50;
console.log("Email verified via SMTP");

// Check email provider
const domain = result.Domain.toLowerCase();
const mailServers = result.MailServers;

// Corporate email (custom domain) - higher quality
const freEmailProviders = ['gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com'];
const isFreeEmail = freeEmailProviders.includes(domain);

if (!isFreeEmail) {
leadScore += 30;
msg.emailType = "corporate";
} else {
leadScore += 10;
msg.emailType = "personal";
}

// Multiple mail servers indicate professional setup
if (mailServers && mailServers.length > 1) {
leadScore += 10;
}

} else {
// Email doesn't exist - low quality lead
leadScore -= 50;
console.log("Email not verified");
}

msg.leadScore = leadScore;
console.log("Lead score:", leadScore);

Catch-All Detection

msg.con_id = msg.configId;

// Test with random email on same domain
const domain = "example.com";
const randomEmail = `random_${Date.now()}@${domain}`;

msg.emailAddress = randomEmail;

// After Validate SMTP node
if (msg.result.Success) {
console.log("Domain appears to be catch-all");
msg.isCatchAll = true;

// Catch-all domains accept all emails
// Cannot verify specific mailbox existence
// May need additional verification methods

} else {
console.log("Domain is not catch-all");
msg.isCatchAll = false;

// Can trust SMTP validation results
// Specific mailbox verification is reliable
}

Detailed SMTP Debug Analysis

msg.con_id = msg.configId;
msg.emailAddress = msg.userEmail;

// After Validate SMTP node
const result = msg.result;
const smtpDebug = result.SmtpDebug;

if (smtpDebug && smtpDebug.length > 0) {
smtpDebug.forEach(debug => {
console.log("Mail Server:", debug.MailHost);
console.log("Port Opened:", debug.PortOpened);
console.log("Connection Established:", debug.Connection);

if (debug.Errors && debug.Errors.length > 0) {
console.log("Errors:");
debug.Errors.forEach(err => console.log(" -", err));
}

if (debug.Response) {
console.log("SMTP Response:", debug.Response);
}
});
}

// Determine failure reason
if (!result.Success) {
const allPortsClosed = smtpDebug.every(d => !d.PortOpened);
const allConnectionsFailed = smtpDebug.every(d => !d.Connection);

if (allPortsClosed) {
msg.failureReason = "smtp_port_blocked";
} else if (allConnectionsFailed) {
msg.failureReason = "smtp_connection_failed";
} else {
msg.failureReason = "mailbox_not_found";
}
}

Error Handling

The Validate SMTP node returns specific errors in these cases:

  • ErrInvalidArg

    • Configuration ID is empty
    • Email Address is empty
  • ErrNotFound

    • Configuration not found for the provided Configuration ID
  • ErrInternal

    • Failed to retrieve Configuration ID or Email Address
    • Failed to set output result
  • ErrRuntime

    • Failed to validate email via SMTP
    • SMTP connection error
    • Mail server rejected verification
    • Network timeout

Best Practices

  1. Use as Final Validation Step

    • Run cheaper validations first (Regex, MX Blacklist, MX)
    • Use SMTP only for emails that passed earlier checks
    • Saves time and resources
  2. Configure Appropriate Timeouts

    • Set connection timeout based on network conditions
    • Use longer timeouts for international mail servers
    • Balance between accuracy and speed
  3. Implement Rate Limiting

    • Add delays between SMTP validations
    • Avoid triggering anti-spam measures
    • Respect mail server resources
    • Use 1-2 second delays minimum
  4. Handle Temporary Failures

    • Implement retry logic for network errors
    • Use exponential backoff
    • Distinguish between temporary and permanent failures
  5. Use Safe Check Mode When Appropriate

    • Enable for high-volume validation
    • Use when mail servers are sensitive
    • Accept slightly lower accuracy for safety
  6. Validate Verifier Email

    • Use real, valid verifier email address
    • Use domain you control
    • Consider dedicated validation email

Performance Characteristics

  • Speed - Slow (SMTP connection required, 1-5 seconds per email)
  • Accuracy - Highest (verifies actual mailbox)
  • Network - Requires SMTP connection (port 25 or custom)
  • Resource - Medium CPU, network bandwidth, time
  • Scalability - Limited due to speed and server protection

Common SMTP Response Codes

CodeMeaningValidation Result
250Mailbox existsSuccess
550Mailbox not foundFailure
551User not localFailure
552Mailbox fullSuccess (mailbox exists)
553Invalid mailbox nameFailure
450Temporary failureRetry recommended
421Service unavailableRetry recommended

Common Errors and Solutions

ErrorCauseSolution
"Configuration Id cannot be empty"Configuration ID not providedEnsure Configuration node runs first
"Email Address cannot be empty"Email input not setVerify Email Address input has value
"Configuration not found"Invalid Configuration IDCheck Configuration ID is correct
"Failed to validate email via SMTP"SMTP connection or verification failedCheck network, verify email exists
Connection timeoutNetwork slow or port blockedIncrease timeout, check firewall/port 25
Port not openedSMTP port blockedVerify port 25 accessible, check firewall
GreylistingServer using greylistingRetry after delay (usually 15-30 min)
Catch-all domainDomain accepts all emailsCannot verify specific mailbox, use other methods

Tips for Effective Use

  1. Optimize Validation Strategy

    1. Regex (filter bad formats)
    2. MX Blacklist (filter disposables)
    3. MX (verify domain)
    4. SMTP (verify mailbox) - only for critical emails
  2. Handle Catch-All Domains

    • Detect catch-all configuration
    • Use alternative validation methods
    • Consider domain reputation instead
  3. Manage Validation Volume

    • Batch validate during off-peak hours
    • Implement queuing system
    • Monitor validation rates
    • Respect mail server limits
  4. Error Analysis and Reporting

    • Log SMTP debug information
    • Track failure patterns
    • Identify problematic mail servers
    • Improve validation logic
  5. Compliance and Ethics

    • Don't abuse SMTP verification
    • Respect privacy and anti-spam laws
    • Implement opt-in mechanisms
    • Provide clear communication

Security and Privacy Considerations

  • Port 25 Access - Ensure SMTP port is accessible from your network
  • IP Reputation - High-volume validation may impact IP reputation
  • Greylisting - Some servers use greylisting, causing temporary failures
  • Privacy - SMTP verification may alert mailbox owner
  • Rate Limiting - Implement to avoid being flagged as spam
  • Verifier Email - Use appropriate email for verification identity
  • Safe Check Mode - Use when validation might trigger security measures
  • Fail Fast - Enable for faster failure detection in production

Advanced Configuration Options

Connection Settings

// In Configuration node

// Connection Timeout: 3 (seconds)
// Response Timeout: 3 (seconds)
// Connection Attempts: 2

// Smtp Port: 25 (standard SMTP port)
// Smtp Fail Fast: true (fail on first error)
// Smtp Safe Check: false (thorough verification)

For High-Volume Processing

// Connection Timeout: 2
// Response Timeout: 2
// Connection Attempts: 1
// Smtp Fail Fast: true
// Smtp Safe Check: true

For Maximum Accuracy

// Connection Timeout: 5
// Response Timeout: 5
// Connection Attempts: 3
// Smtp Fail Fast: false
// Smtp Safe Check: false

Integration with Email Marketing

Use SMTP validation to improve email campaign deliverability:

  1. Pre-Campaign Validation

    • Validate email list before sending campaign
    • Remove non-existent mailboxes
    • Reduce bounce rate
  2. New Subscriber Validation

    • Verify email during signup
    • Prevent fake registrations
    • Improve list quality
  3. List Maintenance

    • Periodically revalidate old emails
    • Remove bounced addresses
    • Keep list fresh and engaged
  4. Deliverability Metrics

    • Track validation success rate
    • Monitor email quality trends
    • Optimize collection methods