> ## Documentation Index
> Fetch the complete documentation index at: https://docs.helohq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send via SMTP

> Start sending via SMTP in minutes

export const CopyText = ({text, icon}) => {
  const [copied, setCopied] = useState(false);
  const copyToClipboard = () => {
    navigator.clipboard.writeText(text);
    setCopied(true);
    setTimeout(() => {
      setCopied(false);
    }, 5000);
  };
  return <>
      <span>{text}</span>{" "}
      <span aria-label="Copy" style={{
    cursor: "pointer"
  }} onClick={copyToClipboard}>
        {icon}
      </span>{" "}
      {copied ? "Copied!" : ""}
    </>;
};

Are you ready to send your first email with Helo? Because we sure are!

Here are the 4 easy steps to sending your first email with us via SMTP. (Want to send via API instead? Follow our [API quickstart guide](/getting-started/quickstart-send-with-api).)

<Steps>
  <Step title="Set up your sending domain" titleSize="h3">
    Before you can send, you need to add a sending domain.

    Head over to our [domains page](/core/domains) for instructions on how to set up your domain.
  </Step>

  <Step title="Create your first Channel" titleSize="h3">
    [Channels](/core/channels) allow you to segregate your mail. Some common ways you might want to do this:

    * By environment (e.g., production, staging, etc.)
    * By the type of mail you're sending (e.g., newsletters, transactional, etc.)
    * By customer (e.g., customer abc)

    If something goes awry with your sending in one Channel (e.g., high bounce rate, high spam, etc.), this won't impact sending on your other Channels.

    Go ahead and create your first Channel via the `Channels` section in your Helo dashboard.
  </Step>

  <Step title="Create your SMTP user" titleSize="h3">
    Create a new [SMTP user](/core/smtp-user) — that's what will give you the SMTP user ID and password you'll need to authenticate your SMTP sending.

    <Info>
      SMTP users must be scoped to a Channel. So When you create your SMTP user, make sure it's set up to send via the Channel you just created.
    </Info>
  </Step>

  <Step title="Use your SMTP user credentials to send your first email" titleSize="h3">
    You’re ready for your first send! Use the following details to set up your SMTP sending with the client of your choice:

    * **Host**: <CopyText text="smtp.helohq.com" icon={<Icon icon="copy"/>} />
    * **Port**: 587 (recommended), 25, 2525, or 465.
    * **Username**: `YOUR_SMTP_USER_ID`
    * **Password**: `YOUR_SMTP_USER_PASSWORD`

    <Info>
      While your account is in test mode, you can only send to email addresses on domains you have verified in step #1. Select the recipient for your first test send accordingly.
    </Info>

    Below are examples of sending via SMTP in some common languages. For testing with SMTP on the command-line, we recommend [swaks](https://github.com/jetmore/swaks).

    <CodeGroup>
      ```bash command-line theme={null}
      swaks \
          --server smtp.helohq.com:587 \
          --tls \
          --from "$FROM_ADDRESS" \
          --to recipient@example.com \
          --body "<html><body><h1>Test message HTML</h1><p>Test message paragraph</p></body></html>" \
          --auth PLAIN \
          --auth-user "$SMTP_USER_ID" \
          --auth-password "$SMTP_USER_PASSWORD" \
          --add-header "X-Helo-TrackLinks: true" \
          --add-header "X-Helo-TrackOpens: true" \
          --add-header "Content-Type: text/html"
      ```

      ```javascript JavaScript theme={null}
      import nodemailer from "nodemailer";

      const smtpUserId = process.env.SMTP_USER_ID;
      const smtpPassword = process.env.SMTP_PASSWORD;
      const fromAddress = process.env.FROM_ADDRESS;

      const transporter = nodemailer.createTransport({
        host: "smtp.helohq.com",
        port: 587,
        secure: false,
        requireTLS: true,
        auth: {
          type: "plain",
          user: smtpUserId,
          pass: smtpPassword,
        },
      });

      await transporter.sendMail({
        from: fromAddress,
        to: "recipient@example.com",
        subject: "Test Message",
        html: "<html><body><h1>Test message HTML</h1><p>Test message paragraph</p></body></html>",
        text: "Test message text",
        headers: {
          "X-Helo-TrackLinks": "true",
          "X-Helo-TrackOpens": "true",
        },
      });
      ```

      ```python Python theme={null}
      import smtplib
      from email.mime.multipart import MIMEMultipart
      from email.mime.text import MIMEText

      smtp_user_id = os.environ['SMTP_USER_ID']
      smtp_password = os.environ['SMTP_PASSWORD']
      from_address = os.environ['FROM_ADDRESS']

      msg = MIMEMultipart('alternative')
      msg['Subject'] = 'Test Message'
      msg['From'] = from_address
      msg['To'] = 'recipient@example.com'
      msg['X-Helo-TrackLinks'] = 'true'
      msg['X-Helo-TrackOpens'] = 'true'

      msg.attach(MIMEText('Test message text', 'plain'))
      msg.attach(MIMEText(
          '<html><body><h1>Test message HTML</h1><p>Test message paragraph</p></body></html>',
          'html'
      ))

      with smtplib.SMTP('smtp.helohq.com', 587) as server:
          server.starttls()
          server.login(smtp_user_id, smtp_password)
          server.sendmail(from_address, ['recipient@example.com'], msg.as_string())
      ```

      ```ruby Ruby theme={null}
      require 'net/smtp'

      smtp_user_id = ENV['SMTP_USER_ID']
      smtp_password = ENV['SMTP_PASSWORD']
      from_address = ENV['FROM_ADDRESS']

      message = <<~EMAIL
        From: #{from_address}
        To: recipient@example.com
        Subject: Test Message
        MIME-Version: 1.0
        Content-Type: text/html; charset=UTF-8
        X-Helo-TrackLinks: true
        X-Helo-TrackOpens: true

        <html><body><h1>Test message HTML</h1><p>Test message paragraph</p></body></html>
      EMAIL

      smtp = Net::SMTP.new('smtp.helohq.com', 587)
      smtp.enable_starttls
      smtp.start('localhost', smtp_user_id, smtp_password, :plain) do |conn|
        conn.send_message(message, from_address, 'recipient@example.com')
      end
      ```

      ```csharp C# theme={null}
      using System.Net;
      using System.Net.Mail;

      var smtpUserId = Environment.GetEnvironmentVariable("SMTP_USER_ID");
      var smtpPassword = Environment.GetEnvironmentVariable("SMTP_PASSWORD");
      var fromAddress = Environment.GetEnvironmentVariable("FROM_ADDRESS");

      var message = new MailMessage
      {
          From = new MailAddress(fromAddress),
          Subject = "Test Message",
          Body = "<html><body><h1>Test message HTML</h1><p>Test message paragraph</p></body></html>",
          IsBodyHtml = true,
      };
      message.To.Add("recipient@example.com");
      message.Headers.Add("X-Helo-TrackLinks", "true");
      message.Headers.Add("X-Helo-TrackOpens", "true");

      using var client = new SmtpClient("smtp.helohq.com", 587)
      {
          Credentials = new NetworkCredential(smtpUserId, smtpPassword),
          EnableSsl = true,
      };
      client.Send(message);
      ```

      ```go Go theme={null}
      package main

      import (
      	"fmt"
      	"net/smtp"
      	"os"
      	"strings"
      )

      func main() {
      	host := "smtp.helohq.com"
      	addr := fmt.Sprintf("%s:%d", host, 587)

      	smtpUserId := os.Getenv("SMTP_USER_ID")
      	smtpPassword := os.Getenv("SMTP_PASSWORD")
      	fromAddress := os.Getenv("FROM_ADDRESS")

      	auth := smtp.PlainAuth("", smtpUserId, smtpPassword, host)

      	body := strings.Join([]string{
      		"From: " + fromAddress,
      		"To: recipient@example.com",
      		"Subject: Test Message",
      		"MIME-Version: 1.0",
      		"Content-Type: text/html; charset=UTF-8",
      		"X-Helo-TrackLinks: true",
      		"X-Helo-TrackOpens: true",
      		"",
      		"<html><body><h1>Test message HTML</h1><p>Test message paragraph</p></body></html>",
      	}, "\r\n")

      	if err := smtp.SendMail(addr, auth, fromAddress,
      		[]string{"recipient@example.com"}, []byte(body)); err != nil {
      		panic(err)
      	}
      }
      ```
    </CodeGroup>
  </Step>
</Steps>

## Need help sending your first email?

If you're stuck or need a hand sending your first email, just send us a quick note (or join us on [discord](https://discord.gg/suQD9T3nDN)!). We're here to help.

<Card title="Contact us" icon="heart" href="mailto:support@helohq.com" horizontal>
  Human (!) support whenever you need it.
</Card>

## Next steps

Now that your first email is out the door, explore these key features:

<Columns cols={2}>
  <Card title="Sending transactional" icon="mail" href="/core/sending-transactional">
    Send transactional mail like password resets or notifcations.
  </Card>

  <Card title="Sending broadcasts" icon="mails" href="/core/sending-broadcasts">
    Send the same message to multiple recipients.
  </Card>

  <Card title="Domains" icon="globe" href="/core/domains">
    Set up your domains for sending mail.
  </Card>

  <Card title="Channels" icon="chart-no-axes-gantt" href="/core/channels">
    Isolate your sending with Channels.
  </Card>

  <Card title="Activity" icon="newspaper" href="/core/activity">
    Understand how your email sending is performing.
  </Card>

  <Card title="Suppressions" icon="mail-x" href="/core/suppressions">
    Manage suppressions to improve deliverability.
  </Card>

  <Card title="Webhooks" icon="computer" href="/core/webhooks">
    Receive webhooks for events.
  </Card>
</Columns>
