SMTP Integration with Netcore

Learn how to send an SMTP Email via the Netcore CPaaS dashboard.

Overview

  • Simple Mail Transfer Protocol (SMTP) is the standard protocol for sending email messages between servers.
  • SMTP handles the submission of outgoing email from applications or mail clients to another mail server or relay.

Netcore supports SMTP so you can send transactional or marketing emails via an SMTP interface, using credentials already provided in your Netcore account. This can be an easier alternative (or complement) to API-based sending, especially in legacy systems or standard mail clients.

Example Use Case – Sending Order Confirmation Emails

Scenario:
An online store wants to send order confirmation emails every time a customer completes a purchase.

Solution with Netcore SMTP:

  1. The store’s backend server is configured with Netcore SMTP (smtp.netcorecloud.net, port 587).

  2. When a customer places an order, the server creates an email message with:

    • From: [email protected]
    • To: customer’s email
    • Subject: “Your Order Confirmation”
    • Body: Order details and shipping info.
  3. The server authenticates with Netcore SMTP using its username and password.

  4. Netcore delivers the email to the customer’s inbox, and the store can view delivery reports in the Netcore CPaaS dashboard.

import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

# SMTP configuration
SMTP_HOST = "smtp.netcorecloud.net"
SMTP_PORT = 587
SMTP_USERNAME = "YOUR_SMTP_USERNAME"
SMTP_PASSWORD = "YOUR_SMTP_PASSWORD"

# Email details
sender_email = "[email protected]"
recipient_email = "[email protected]"

# Create the email
msg = MIMEMultipart()
msg["From"] = sender_email
msg["To"] = recipient_email
msg["Subject"] = "Your Order Confirmation"

body = """
Hello,

Thank you for your order! Your payment has been received and we are preparing your shipment.

Order Details:
- Order ID: 12345
- Estimated Delivery: 3-5 business days

Best regards,
Your Store Team
"""

msg.attach(MIMEText(body, "plain"))

# Send the email
try:
    with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as server:
        server.starttls()  # Secure the connection
        server.login(SMTP_USERNAME, SMTP_PASSWORD)
        server.sendmail(sender_email, recipient_email, msg.as_string())
    print("Order confirmation email sent successfully!")
except Exception as e:
    print("Failed to send email:", e)
const nodemailer = require("nodemailer");

// SMTP configuration
const transporter = nodemailer.createTransport({
  host: "smtp.netcorecloud.net",
  port: 587,
  secure: false, // use TLS
  auth: {
    user: "YOUR_SMTP_USERNAME",
    pass: "YOUR_SMTP_PASSWORD",
  },
});

// Email details
const mailOptions = {
  from: "[email protected]",
  to: "[email protected]",
  subject: "Your Order Confirmation",
  text: `Hello,

Thank you for your order! Your payment has been received and we are preparing your shipment.

Order Details:
- Order ID: 12345
- Estimated Delivery: 3-5 business days

Best regards,
Your Store Team
`,
};

// Send the email
transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    return console.error("Failed to send email:", error);
  }
  console.log("Order confirmation email sent:", info.messageId);
});

Integrate with SMTP

This section lists the required configuration and best practices.

ComponentValue / Description
SMTP Hostnamesmtp.netcorecloud.net
Ports25, 2525, 587 (for TLS/STARTTLS)
Username & PasswordUse the SMTP username and password from your Netcore → Settings → Integrations section.
SSL / TLS UseUse STARTTLS / TLS on supported ports (e.g., 587, 2525). If using port 465, standard SSL may be required (if supported.

Step-by-step Setup

  1. Log in to your Netcore dashboard.
  2. Navigate to Settings → Integrations to get your SMTP credentials (username/password).
  3. In your system (application server, mail library, or client), set the SMTP host to smtp.netcorecloud.net.
  4. Use one of the supported ports. If connecting over TLS / STARTTLS, use port 587 or 2525. If needed, use port 25 (less secure).
  5. Enable authentication: set username and password.
  6. Ensure your system negotiates TLS if available.

Refer to the given table to know the fields available on the SMTP Relay screen.

FieldDescription
HostThe SMTP server address used to send emails.
PortThe network port used to connect to the SMTP server. The default is 25; you can also use 587 or 2525 for TLS/STARTTLS connections.
AuthenticationDefines the authentication method. Netcore supports Plain text or TLS; TLS is recommended for secure connections.
UsernameYour unique SMTP username, auto-generated by Netcore, required to authenticate your connection.
PasswordThe SMTP password linked to your account. Click Show to view it or Change to regenerate a new one. Remember to update all apps using this password if you change it.
Allowed IPsRestricts SMTP Relay access to specific application/server IP addresses or IP ranges. Only connections originating from configured IPs are allowed to authenticate and inject emails. This provides an additional security layer against unauthorized email injection if SMTP credentials are compromised.
💡

Tips

  • Always verify that your sending domain is properly verified and approved in Netcore (see “sending domains”) so that sender emails are not rejected.
  • Your firewall / hosting provider must allow outbound SMTP on the port you choose (especially if using 587 or 2525).

Send Test Mail

Click SEND TEST MAIL to test our SMTP connection and activity logging. Sends a sample email and logs activity so you can confirm that your configuration works.

Select Email From and Email To, click SEND MAIL to complete the process.

Character Encoding

  • Use UTF-8 encoding for message subject, body, and headers. It supports international characters, emojis, etc.
  • For plain text emails, specify the charset header: Content-Type: text/plain; charset="UTF-8"
  • For HTML emails: Content-Type: text/html; charset="UTF-8"
  • Ensure your programming library or mail client is configured to encode the message accordingly (avoid default system encodings that may be ANSI / ASCII only).

Allowed IPs for SMTP Relay

Netcore provides Allowed IPs as a security feature for SMTP Relay. It allows you to restrict which application or server IP addresses are permitted to connect to Netcore SMTP and inject emails. This provides an additional layer of protection against unauthorized email injection, particularly in scenarios where SMTP credentials may be compromised or exposed.

How it works

When Allowed IPs are configured, Netcore accepts SMTP connections only from the IP addresses or IP ranges specified by the user. Any SMTP connection originating from an IP address that is not on the allowed list will be denied.
For example, if your applications send emails from the following IP addresses:

  • 203.0.113.25

  • 203.0.113.26

  • 10.0.0.0/24

    You can add these IPs or CIDR ranges to the Allowed IPs list. Only applications connecting from these configured IPs will be permitted to inject emails through the SMTP Relay.

    How to configure Allowed IPs

  1. Log in to your Netcore dashboard.
  2. Navigate to Settings > Integrations > SMTP Relay > Allowed IPs.
  3. Add the public IP addresses or IP ranges from which your applications will connect to the Netcore SMTP Relay.
  4. Save the configuration.

    Security benefit

    • Allowed IPs provide an additional security control alongside SMTP authentication.
    • If SMTP credentials are compromised, an attacker attempting to connect from an unauthorized IP address will not be able to inject emails through the SMTP Relay.
      🌟

      Best Practice

      Configure Allowed IPs with the minimum set of application/server IPs required for your email infrastructure. Keep the list updated whenever your application infrastructure or outbound network IPs change.


Send an SMTP Email

Here are examples of sending emails via SMTP using popular languages and using well-known mail clients.

Examples in Programming Languages

Python (using smtplib)

import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

smtp_host = "smtp.netcorecloud.net"
smtp_port = 587
username = "YOUR_SMTP_USERNAME"
password = "YOUR_SMTP_PASSWORD"

msg = MIMEMultipart()
msg["From"] = "[email protected]"
msg["To"] = "[email protected]"
msg["Subject"] = "Test Email via Netcore SMTP"

body = """\
Hello,

This is a test email sent using Netcore SMTP.

Regards,
Your app
"""
msg.attach(MIMEText(body, "plain"))

with smtplib.SMTP(smtp_host, smtp_port) as server:
    server.starttls()
    server.login(username, password)
    server.sendmail(msg["From"], msg["To"], msg.as_string())

Node.js (using nodemailer)

const nodemailer = require("nodemailer");

let transporter = nodemailer.createTransport({
  host: "smtp.netcorecloud.net",
  port: 587,
  secure: false, // true for port 465, false for others
  auth: {
    user: "YOUR_SMTP_USERNAME",
    pass: "YOUR_SMTP_PASSWORD",
  },
});

let mailOptions = {
  from: '"Sender Name" <[email protected]>',
  to: "[email protected]",
  subject: "Test Email via Netcore SMTP",
  text: "Hello,\nThis is a test email via Netcore SMTP.",
};

transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    return console.error("Error sending mail:", error);
  }
  console.log("Message sent:", info.messageId);
});

PHP (using PHPMailer)

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);
try {
    $mail->isSMTP();
    $mail->Host       = 'smtp.netcorecloud.net';
    $mail->SMTPAuth   = true;
    $mail->Username   = 'YOUR_SMTP_USERNAME';
    $mail->Password   = 'YOUR_SMTP_PASSWORD';
    $mail->SMTPSecure = 'tls';      // or 'ssl' if using port 465
    $mail->Port       = 587;

    $mail->setFrom('[email protected]', 'Sender Name');
    $mail->addAddress('[email protected]', 'Recipient Name');
    $mail->Subject = 'Test Email via Netcore SMTP';
    $mail->Body    = "Hello,\nThis is a test email via Netcore SMTP.";

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}

Using Common Mail Clients

ClientSetup Steps
Outlook
  1. Open Account Settings. 2. Add a new email account or modify existing. 3. For SMTP server, set host = smtp.netcorecloud.net, port = 587, encryption TLS. 4. Enter your SMTP username and password. 5. Make sure "Require logon using secure password" / authentication is enabled.
Thunderbird
  1. Tools → Account Settings. 2. Outgoing Server (SMTP) settings. 3. Configure with host, port, SSL/TLS or STARTTLS, username/password. 4. Save and test sending.

Customizing Messages with SMTP Headers

Headers allow you to add metadata or control the behavior of email delivery. Some you may use:

HeaderPurpose / Example
From:The displayed sender. For example: From: Your App <[email protected]>
Reply-To:Where replies should be sent, if different from From:
CC: / BCC:Carbon copy / blind carbon copy recipients
Message-ID:Unique ID of the message. Many mail libraries set this automatically
Date:Timestamp of sending. This is usually auto-generated, but can be customized
MIME-Version: & Content-Type:For specifying multipart emails / HTML vs plain text.
DKIM-Signature: / SPF related headersFor ensuring compliance and deliverability (Netcore handles DKIM/SPF setup for verified domains)
Custom headers (e.g. X-Tag:, X-Campaign:, etc.)You may use for your internal tracking / integrating with Netcore's tagging/dashboards
X-Netcore-APIJSON object controlling per-message tracking. Set options.open_tracking, options.click_tracking, and options.subscription_tracking to true to enable or false to suppress tracking for this message.

All three fields are optional and independent; if a field is omitted, your account's default setting applies for that tracking type.
Example: X-Netcore-API: {"options": {"open_tracking": false, "click_tracking": false, "subscription_tracking": true}}
👍

Best Practices

  • Don’t forget “From” addresses outside verified domains.
  • Avoid conflicting headers.
  • Use anti-spam compliant headers (e.g., List-Unsubscribe if needed).

Send Test SMTP Email Using Telnet

Telnet provides a low-level way to test whether your SMTP server is reachable and configured correctly.

$ telnet smtp.netcorecloud.net 587

Once connected:

EHLO yourhostname.com
STARTTLS
[negotiation of TLS here]
EHLO yourhostname.com
AUTH LOGIN
[base64-encoded username]
[base64-encoded password]
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
DATA
Subject: Test SMTP via Netcore

Hello,
This is a test message via Netcore using SMTP and telnet.

.
QUIT

What you expect to see:

  • 220 on initial connection
  • After EHLO, capabilities including STARTTLS
  • After AUTH, success (235) or failure codes
  • After DATA and ending with ., message accepted (e.g. 250 Ok)

Using Tags with SMTP

Tags allow you to label or categorize emails so you can track them in Netcore dashboards or reporting.

  • When sending via SMTP, include a custom header (e.g. X-Netcore-Tag: <tag_name>) or specific header that Netcore recognizes for tagging.
  • Ensure tag names conform to allowed patterns (alphanumeric, dashes/underscores) — check Netcore policy.
  • Use tags for things like campaign names, environment (dev / staging / production), or type of email (confirmation, password reset, newsletters).
  • Tags help in filtering and tracking in Netcore reporting.

Change Your SMTP Password

Follow the given steps to change your SMTP password.

  1. Log in to your Netcore dashboard.
  2. Navigate to Settings > Integrations or the SMTP Credentials section.
  3. Locate the current SMTP password setting. Click Change Password.
  4. Generate/reset the password.
    📘

    Note

    • This will immediately affect any systems using the old password, so plan for downtime or coordinate deployments.
  5. Update your application/clients with the new password.

Summary

SMTP with Netcore gives you a flexible, reliable way to send emails using standard protocols. Key takeaways:

  • Use smtp.netcorecloud.net with ports 25, 2525, or 587.
  • Turn on TLS/STARTTLS.
  • Authenticate using a valid username/password.
  • Verify your sending domains.
  • Use headers/tags for better tracking.
  • Handle errors by checking credentials, network, and domain verification.

Did this page help you?