Sign inStart for $1

ToolsPublished 2026-10-19Sources checked 2026-10-19By ColdAgentAI

Connect an SMTP mailbox to ColdAgentAI

ColdAgentAI connects a mailbox in one of two ways: you give it the IMAP and SMTP server details and a password, or you sign in with Google or Microsoft. The IMAP and SMTP route works with any provider that offers both protocols, and the connection is tested against your mail server before anything is saved. Use port 465 or 587 for SMTP and port 993 for IMAP, and use an app password where your provider asks for one.

#The ways a mailbox can be connected

A mailbox in ColdAgentAI is an account that sends your outreach and receives the replies. Every mailbox has a provider type, and three exist today: imap_smtp, gmail and microsoft_graph. The first works with nearly any mailbox host. The other two use OAuth, which means a person approves access on the provider's own consent screen and ColdAgentAI never sees the account password.

MethodWhat you provideGood for
IMAP and SMTPAddress, plus a host, port, TLS mode, user name and password for each of IMAP and SMTPAny host that offers both protocols, including a custom domain mailbox
Gmail sign-inApproval on a Google consent screenGoogle accounts, with no password shared
Microsoft 365 sign-inApproval on a Microsoft consent screenMicrosoft 365 mailboxes, with no password shared

Prefer the sign-in routes when your provider offers them and your account is allowed to use them. Google says as much on its own help pages: app passwords aren't recommended and are unnecessary in most cases, and it recommends "Sign in with Google" to connect apps. If a sign-in connect is not available on your account, the IMAP and SMTP route is the fallback, and the rest of this guide is about that route.

Gmail and Microsoft sign-in depend on how your ColdAgentAI workspace is set up. If a connect request answers that the provider is unavailable, connect the same mailbox over IMAP and SMTP instead.

The API route for each method is listed in the API reference: POST /v1/mailboxes connects over IMAP and SMTP, POST /v1/mailboxes/gmail/connect and POST /v1/mailboxes/microsoft/connect start a sign-in (the mailbox owner approves on the consent screen, copies the code and state that the approval page shows, and you finish with POST /v1/mailboxes/gmail/complete or POST /v1/mailboxes/microsoft/complete using your own key within 10 minutes), POST /v1/mailboxes/:id/check re-tests a stored mailbox, and DELETE /v1/mailboxes/:id removes one together with its stored credentials.

#IMAP, SMTP and why you need both

The two protocols do opposite jobs. SMTP carries a message out: ColdAgentAI hands your email to your provider's submission server and that server delivers it. IMAP reads mail in: ColdAgentAI looks in the inbox for replies, bounces and opt-outs, so a reply lands next to the campaign that earned it. Microsoft describes the same split for its own service, noting that POP3 and IMAP4 clients can only receive messages and so need to use authenticated SMTP to send them. That is why the connect request takes two sets of server details, one per protocol.

Each set has the same five fields: host, port, whether TLS starts immediately, user name and password. The user name is often the full email address, but not always, and the IMAP and SMTP passwords are frequently the same value. Take the exact host names from your provider's own help page rather than guessing; a host such as smtp.example.com is a placeholder and will not work until you replace it with the real one.

SMTP for sending is called message submission, and it is a distinct service from the server-to-server relay that moves mail between providers. The submission standard says that message relay is unaffected, and continues to use SMTP over port 25, while submission is normally over port 587. It also requires that a submission server, by default, reject mail from a session that has not logged in. That is the reason an SMTP password is part of the request: without a successful login the server will not accept your message.

#Ports and TLS: what to enter

Each server block has a single yes or no switch for TLS, called secure. When it is on, the connection is encrypted from the first byte, which the standards call implicit TLS and which belongs on ports 465 (SMTP) and 993 (IMAP). When it is off, the connection starts in the clear and then must upgrade with a STARTTLS command, which is how port 587 normally works. ColdAgentAI refuses to continue if that upgrade does not succeed, so there is no setting that sends your password unencrypted.

ProtocolPortTLS switch (`secure`)What the standard says
SMTP submission465OnThe "submissions" service, where a TLS handshake begins immediately
SMTP submission587OffReserved for message submission; connection upgrades with STARTTLS
IMAP993OnThe "imaps" service, where a TLS handshake begins immediately
IMAP143OffStarts in the clear; ColdAgentAI requires the STARTTLS upgrade to succeed

Which of 465 and 587 should you choose? RFC 8314 recommends implicit TLS for mail submission and access, and it also says that there is no significant difference between the security properties of STARTTLS on port 587 and Implicit TLS on port 465 as long as both sides require TLS to be negotiated before any message is submitted. So pick whichever your provider documents. If the provider lists both, take 465 with the switch on; if it lists only 587, take 587 with the switch off.

Three behaviours of the ColdAgentAI connection are worth knowing before you send the request. First, only the standard mail ports are accepted: 143 and 993 for IMAP, and 25, 465 and 587 for SMTP. A custom port is refused. Second, TLS certificates are always verified, and the connection needs TLS 1.2 or newer, in line with the same RFC, which says mail clients MUST implement TLS 1.2 or later. A server with a self-signed or expired certificate will fail to connect. Third, the host must be a public name. A name that resolves to a private, loopback or internal address is refused, and the check connects to the exact address it validated so a name cannot be pointed somewhere else midway.

Port 25 is accepted but is the relay port. Use 465 or 587 for sending from a mailbox, which is what submission servers are built for.

#Passwords, app passwords and sign-in blocks

The most common reason a connect fails is the password. Providers that use two-step verification do not let a mail program log in with your normal password, so they offer a separate generated password for it. Google and Microsoft both do this, with different rules.

Google accounts

Microsoft accounts

  • Microsoft explains that some apps do not support two-step verification, and that for work or school accounts you can create an auto-generated password to use with each non-browser app. The steps are: open the Security info page in My Account, choose Add method, choose App password, name it, and copy the password.
  • The same page warns that your administrator may not allow app passwords, and that if you do not see the option it is not available in your organization. There is also a limit of 40 passwords per user.
  • For Exchange Online mailboxes, Microsoft documents that SMTP AUTH, the login used for sending, is typically on TCP port 587 and that it is a setting an administrator can turn off for the whole organization or for single mailboxes.
  • Microsoft also says that if security defaults are enabled in an organization, SMTP AUTH is already disabled, and that an authentication policy that disables basic authentication for SMTP blocks the protocol even where the settings allow it. If you are told the login is refused for a Microsoft 365 address and the password is right, ask the administrator about these, or use the Microsoft sign-in connect instead.

#Connect-and-verify checklist

Work through these steps in order. The example values use a fictional domain, example.com, and you replace each with the details from your provider.

  1. Decide the route. If the mailbox is a Google or Microsoft 365 account and the connect is available to you, start the sign-in connect and skip to step 7. Otherwise continue with IMAP and SMTP.
  2. Make sure the mailbox can log in from a mail program. For Google, turn on 2-Step Verification and create an app password. For Microsoft 365, confirm with your administrator that SMTP AUTH is allowed for the mailbox and create an app password if your organization uses them. For other hosts, check that SMTP and IMAP access is enabled in the account settings.
  3. Collect the server details from your provider's own help page: the SMTP host, port and TLS mode, the IMAP host, port and TLS mode, and the user name for each.
  4. Match the TLS switch to the port. Port 465 or 993 means the switch is on. Port 587 or 143 means it is off and the server must support STARTTLS.
  5. Send POST /v1/mailboxes with the address, a display name and both server blocks. Leave the daily limit and the send ramp at their defaults for now.
  6. Read the result. A success returns the stored mailbox with its status. A failure stores nothing and names the problem; find it in the error table below, fix that one thing and submit again.
  7. Run a check on the new mailbox with POST /v1/mailboxes/:id/check. It proves the stored credentials still log in without sending any mail, and it also reads the SPF, DKIM and DMARC records of the mailbox domain. Confirm that connectivity.status is ok.
  8. Read the DNS part of the same response. A fail or missing verdict on SPF, DKIM or DMARC means mail from this address is likely to be treated with suspicion, so fix the record before you send a campaign. Our guide on SPF, DKIM and DMARC explains each one.
  9. Set the daily limit for the mailbox with PATCH /v1/mailboxes/:id, and turn on the send ramp if the mailbox is new, so volume rises gradually rather than all at once.
  10. Add the mailbox to a campaign and send the first test message to an address you control. Check that it arrives, that it is not in spam, and that your reply is picked up in the ColdAgentAI inbox.
Example request body for POST /v1/mailboxes (all values are placeholders)
{
  "address": "alex@example.com",
  "display_name": "Alex at Example",
  "imap": { "host": "imap.example.com", "port": 993, "secure": true, "user": "alex@example.com", "pass": "your-app-password" },
  "smtp": { "host": "smtp.example.com", "port": 465, "secure": true, "user": "alex@example.com", "pass": "your-app-password" }
}

The connection test runs the SMTP login first and the IMAP login second, so if both are wrong you will see the SMTP error first. It checks the IMAP side by opening the inbox, and it sends no email while testing. Credentials are encrypted when stored and are never returned by the API.

#Errors, causes and fixes

The messages below are the ones ColdAgentAI returns. Error text names the protocol, either IMAP or SMTP, so you know which block of the request to look at. When the mail server refuses the login, answers with a code of 500 or higher, or the address is not allowed, the message starts with "The mail server refused these credentials:" followed by the reason, and nothing is stored. Network failures and temporary replies come back as a provider error instead. Detail that could reveal internal addresses is kept out of the message on purpose, which means some causes below are the usual ones rather than a certainty.

ErrorLikely causeFix
The mail server refused these credentials: SMTP login was refused, or IMAP login was refused (wrong credentials or the account blocks this sign-in)Wrong user name or password, a normal password used where an app password is needed, or the account blocks this kind of sign-inCreate an app password (Google, Microsoft work or school) or confirm the password in a normal mail program, then retry. Check the user name for that protocol, since it may differ from the email address, and check that the right password went into the right block. For Microsoft 365, ask the administrator whether SMTP AUTH is enabled for the mailbox.
The mail server refused these credentials: SMTP or IMAP server address cannot be used. Use your mail provider's public host name and its standard port.A port that is not standard for that protocol (IMAP 143 or 993, SMTP 25, 465 or 587), a host name that does not resolve, or a name that points to a private addressUse the provider's public host name and one of the standard ports. Check the spelling of the host.
SMTP or IMAP server could not be reached.A timeout or refused connection. A common cause is the TLS switch not matching the port, for example the switch on with port 587Match the switch to the port: on for 465 and 993, off for 587 and 143. Retry; this error is marked as retryable.
The mail server refused these credentials: SMTP or IMAP server rejected the request, followed by a code of 500 or higherThe provider turned the action down permanently, such as SMTP submission not enabled for the accountLook in the account or administrator settings for SMTP and IMAP access, and enable it.
Server asked to retry later (a code from 400 to 499)A temporary condition at the provider, often rate limitingWait a few minutes and retry. This error is marked as retryable.
The plan allows a number of IMAP/SMTP mailboxes and all are connectedThe account has reached its cap on mailboxes connected over IMAP and SMTPRemove a mailbox you no longer use, connect Gmail or Microsoft 365 mailboxes through sign-in, or move to a larger plan.
The state is invalid, already used, expired or belongs to another account.The connect was completed more than ten minutes after it started, was already used, or was sent with another account's keyStart the connect again and open the new link straight away.
The provider did not approve the connectionThe consent screen was cancelled, or one of the requested permissions was declinedStart again and approve every permission requested.
A connect answers that the provider is unavailableGmail or Microsoft sign-in is not set up for this workspaceConnect the mailbox over IMAP and SMTP instead.
Mailbox status shows disconnectedRepeated failed logins, for example after you changed the account password or Google revoked the app passwordCreate a new password, reconnect or replace the credentials, and run a check. A passing check on a disconnected mailbox reconnects it.

#After the mailbox is connected

A connected mailbox has a status of connected, disconnected or error, a daily send limit and a health record: the time of the last check, the count of consecutive failures and the last error. List your mailboxes with GET /v1/mailboxes to see all of this at once. After repeated login failures a mailbox is marked disconnected, which stops campaigns from using it until a check passes again. Network errors and temporary provider slowdowns do not count toward that, only login failures do.

You can change the display name, the daily limit and the volume ramp at any time with PATCH /v1/mailboxes/:id. The ramp only limits ColdAgentAI's own sending from a new mailbox, and it is off until you turn it on. Mail goes out from the least used connected mailbox first, inside each mailbox's limit, so adding a second mailbox spreads the load rather than doubling the volume of the first.

Connecting a mailbox is only the first of several steps in getting set up to send. Read how to set up a domain and mailbox for outreach for the domain side, how many mailboxes to put on one domain in mailboxes per domain, and why a transactional SMTP service is a poor fit for outreach. You can also test your domain records with the free domain checker before you connect anything.

#Frequently asked questions

Can I connect any email provider to ColdAgentAI?

Any mailbox that offers both IMAP for reading and SMTP for sending with a login can be connected. You need the provider's public IMAP and SMTP host names, the standard ports and a working password or app password. Google and Microsoft 365 mailboxes can also connect through sign-in where that is available.

Which SMTP port should I use, 465 or 587?

Use the one your provider documents. RFC 8314 recommends implicit TLS on 465, but also says that STARTTLS on 587 is not significantly different in security when both sides require TLS. Port 465 uses the TLS switch on, and port 587 uses it off.

Do I need an app password for Gmail?

Only on the IMAP and SMTP route, and only when your Google account has 2-Step Verification on. Google recommends Sign in with Google over app passwords, and the Gmail connect in ColdAgentAI uses sign-in so no password is shared. Some accounts cannot create app passwords, for example work and school accounts and accounts with Advanced Protection.

Does the connection test send an email?

No. The test logs in to your SMTP server and opens the inbox on your IMAP server, and it stores nothing if either fails. The later check also sends nothing; it only re-tests the login and reads the DNS records of your domain.

Why did my working mailbox become disconnected?

ColdAgentAI marks a mailbox disconnected after repeated login failures. The usual cause is a changed password, since Google revokes app passwords when the account password changes, or an administrator turning off SMTP access. Create a new password, then run a check, and a passing check reconnects the mailbox.

#Sources

  1. RFC 8314: Cleartext Considered Obsolete, Use of TLS for Email Submission and AccessRead 2026-10-19. Implicit TLS on ports 993 and 465, STARTTLS on 587 equivalent when TLS is required, TLS 1.2 or later for mail clients.
  2. RFC 6409: Message Submission for MailRead 2026-10-19. Submission normally over port 587, relay stays on port 25, submission server requires authentication by default.
  3. Google Account Help: Sign in with app passwordsRead 2026-10-19. What an app password is, 2-Step Verification requirement, when the option is missing, revocation on password change.
  4. Gmail Help: Add Gmail to another email clientRead 2026-10-19. Gmail no longer supports apps that need your username and password; IMAP always on for personal accounts from January 2025.
  5. Microsoft Support: Create app passwords for your work or school accountRead 2026-10-19. App passwords for non-browser apps, administrator may block them, limit of 40, steps in Security info.
  6. Microsoft Learn: SMTP AUTH in Exchange OnlineRead 2026-10-19. SMTP AUTH typically on port 587, IMAP and POP clients need it to send, administrator controls, security defaults disable it.

In ColdAgentAI

Connect Gmail, Microsoft or any IMAP and SMTP mailbox, with unlimited Google and Microsoft mailboxes on every plan.

Free tools for this topic: