Deliverability

Mailjet SMTP "Failed to authenticate on SMTP server" fix

This Swift Mailer error means your shop reached Mailjet's server but the login was rejected. Use the API key as the SMTP username and the secret key as the password, match the port to the encryption setting (587 with TLS, 465 with SSL), and rule out a host firewall.

Sohail HussainSohail Hussain9 min read

Short answer

  • The error "Failed to authenticate on SMTP server with username using 2 possible authenticators" means your shop reached the server but both login methods it tried were refused. With Mailjet, set the SMTP username to your API key and the password to your secret key, not your account email and password.
  • Then match the port and encryption (587 with TLS, or 465 with SSL), re-enter the password after every save, and test from the server shell to rule out a firewall.

You pasted your Mailjet details into thirty bees or PrestaShop, the credentials look right, and the test email returns this:

Failed to authenticate on SMTP server with username "XXXX" using 2 possible authenticators

Sometimes PHP mail() still works, and sometimes the password field is blank every time you reopen the page. Both are covered below.

Why it happens

The wording appears to come from Swift Mailer, the PHP mail library used by thirty bees and older PrestaShop versions. It lists the login mechanisms the server offered (for example LOGIN and PLAIN) and reports that none was accepted. Two things follow:

  • The connection itself worked. If the server were unreachable, you would see a connection error instead (see the error 111 fix below).
  • The wrapper hides the server's real reply. For a wrong username or password that reply is normally a 535 authentication failure, so the real question is why the login was rejected.

People on the thirty bees forum describe this exact setup: Mailjet credentials that look correct, mail() working, and the password field going blank after saving. People on the Mautic forum report a related Mailjet failure from 2017, Connection could not be established with host in-v3.mailjet.com [Connection refused #111]. As far as I can tell, neither thread posted a confirmed fix, so the steps below come from how SMTP authentication and the shop's mail settings behave, not from a confirmed answer in those threads.

CauseSymptomFix
Account login used instead of API keysAuth error right after a fresh entryUse API key and secret key
Password not stored on saveWorks once, fails after a later saveRe-enter password each time
Port and encryption mismatchAuth error or timeout587 with TLS, or 465 with SSL
Host blocks outbound SMTPConnection refused #111Ask the host to open 587 and 465
Typo or stray space in keys535 in a manual testRe-copy the keys

Step-by-step fixes

1. Use the API key and secret key

Mailjet SMTP does not use your account login. The values to enter are:

SettingValue
SMTP serverin-v3.mailjet.com
UsernameYour Mailjet API key
PasswordYour Mailjet secret key
  1. In your Mailjet account, open the API Key Management page.
  2. Copy the API Key and Secret Key for the key you want to use.
  3. Paste them without trailing spaces or line breaks. Copying from a table often adds a space.
  4. If you cannot be sure the secret is right, generate a new one in Mailjet and update the shop. Regenerating may invalidate the old secret for other apps that use it, so check Mailjet's SMTP documentation first.
  5. If you use a sub-account, use that sub-account's own keys.

Check Mailjet's current SMTP documentation for the host and ports, since vendors change them.

2. Make sure the password actually saved

In thirty bees and PrestaShop, the SMTP password field is typically not shown again after saving, so it looks blank whenever you open the e-mail settings page (under Advanced Parameters, look for E-mail). A blank display on its own is normal. The problem is when a save stores an empty value, or browser autofill puts a different password in the field.

  1. Open the page in a private window, or turn off autofill for it.
  2. Type the secret key into the password field.
  3. Save, then immediately use the test email option on the same page.
  4. If the test fails right after a fresh entry, the value is probably wrong. If it only fails after a later save, re-enter the password every time you touch that form.

3. Match the port and encryption

The encryption dropdown has to agree with the port. A mismatch can show up as an authentication failure instead of a clean connection error.

PortEncryption settingNotes
587TLS (STARTTLS)Starts in cleartext, then upgrades with the STARTTLS command
465SSL (implicit TLS)TLS from the first byte of the connection
25NoneOften blocked by hosts; no encrypted login

Try 587 with TLS first, then 465 with SSL. RFC 8314 describes both: clients and servers should implement both STARTTLS on port 587 and Implicit TLS on port 465, and there is no significant difference in security between the two if implemented correctly. For the STARTTLS command itself, see RFC 3207. Also confirm PHP has the OpenSSL extension enabled; without it, encrypted SMTP cannot work, and some stacks fail in confusing ways.

4. Check whether your host blocks outbound SMTP

If you see Connection could not be established with host in-v3.mailjet.com [Connection refused #111] instead of an authentication message, your server cannot reach Mailjet at all. Error 111 is the operating system's "connection refused": a firewall or your host's policy closed the outbound port. Many shared hosts block outbound SMTP by default.

This also explains why mail() can work while SMTP does not. mail() typically hands the message to a local mail program rather than opening a connection from PHP to Mailjet.

Test from the server's shell:

openssl s_client -starttls smtp -connect in-v3.mailjet.com:587

If it prints a certificate and a 250 response, the port is open. If it hangs or says connection refused, ask your host to open outbound 587 and 465, or check the server firewall rules.

Test the login outside your shop

This separates bad credentials from bad shop configuration in a couple of minutes. Encode your keys first (printf avoids adding a newline):

printf 'YOUR_API_KEY' | base64
printf 'YOUR_SECRET_KEY' | base64

Then connect and authenticate by hand:

openssl s_client -starttls smtp -connect in-v3.mailjet.com:587 -crlf
EHLO example.com
AUTH LOGIN

When the server asks for the username (it sends 334 VXNlcm5hbWU6), paste the encoded API key. Then paste the encoded secret for the password.

  • A 235 reply means the credentials are valid, so the fault is in your shop settings (fixes 2 and 3).
  • A 535 reply means the server rejected the keys. Go back to fix 1. In the SMTP authentication standard, RFC 4954, the matching enhanced status is 5.7.8 Authentication credentials invalid.

Keep the secret key private

Do not paste your secret key, or its base64 form, into a support ticket, a forum post or a screenshot. Base64 is an encoding, not encryption.

After login works but mail still fails

Authentication is only the first step. If login succeeds but messages bounce or vanish:

  • Use a sender address, or a domain, that you have validated in your Mailjet account as the shop's sending address.
  • Publish the SPF and DKIM records exactly as Mailjet shows them in its domain setup. If you already have an SPF record, merge Mailjet's entry into it; two separate SPF records on one domain break each other.
  • If a delivered message still lands in spam, check the raw headers of a received test message for SPF and DKIM results.

Checklist before you try again

  • Username is the API key, password is the secret key.
  • No leading or trailing spaces in either value.
  • Port and encryption pair up (587 with TLS, or 465 with SSL).
  • The password was typed fresh and the test email was sent before leaving the page.
  • OpenSSL is enabled in PHP.
  • The openssl s_client test from the server reaches Mailjet.
  • The sending address or domain is validated in Mailjet.

If nothing works

If the manual AUTH LOGIN test returns 535 with keys you just copied fresh, contact Mailjet support. If the connection test hangs or returns error 111, contact your hosting provider instead, because the block is on their side. Include:

  • the API key (never the secret),
  • the exact reply text from the server,
  • the timestamp and your server's outbound IP,
  • the port and encryption you used,
  • what you already tried.

Here is a message you can adapt:

Subject: SMTP authentication rejected for API key {your-api-key}

Hello,

I cannot authenticate to in-v3.mailjet.com on port 587 (STARTTLS).
My shop (thirty bees) reports: Failed to authenticate on SMTP server
with username "{your-api-key}" using 2 possible authenticators.

A manual AUTH LOGIN test from my server returned: {exact reply}
Time of test: {timestamp with timezone}
Server outbound IP: {ip}

I freshly copied the API key and secret key from API Key Management.
Can you check the status of this key and any restrictions on the account?

Thank you

Common questions

Why does PHP mail() work when SMTP fails?

mail() typically passes the message to a local mail program on the server, so it never needs to log in to Mailjet. SMTP opens an authenticated connection from PHP, which is where a wrong key or a blocked port shows up. Mail sent through mail() also often lacks proper SPF and DKIM alignment, so it is more likely to land in spam.

Is "2 possible authenticators" a Mailjet error?

It looks like wording from the shop's mail library rather than a Mailjet message. It means every login method the server offered was refused, and the same text can appear with other SMTP providers.

Can I use my Mailjet account email and password?

For SMTP, no. Use the API key as the username and the secret key as the password.

Should I use port 25?

No. Many hosts block it, and it gives you no encrypted login. Use 587 with TLS or 465 with SSL.

deliverabilitymailjeterror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Related Articles

Deliverability

Failed to authenticate on SMTP server with Mailjet: fix

This error means thirty bees could not log in to Mailjet's SMTP server. Use your Mailjet API key as the username and the secret key as the password, not your account email and password. Set the server to in-v3.mailjet.com and pair port 587 with TLS or port 465 with SSL.

Sohail Hussain|8 min read
Deliverability

Mailjet "Spam Preblocked": why a new domain gets blocked

"Spam Preblocked" means Mailjet stopped the message on its own side, before the recipient's server saw it. On a new domain the likely causes are missing authentication, a root-domain sender, a sudden volume jump, or a shared IP. Fix those, ramp slowly, then send support the message IDs.

Sohail Hussain|9 min read
Deliverability

0x800ccc0e: Outlook Unable to Connect to SMTP Server, Fixed

Outlook error 0x800ccc0e means the app could not open a connection to your outgoing (SMTP) server. Usually the port, encryption setting or password is wrong, or antivirus, a firewall or your ISP is blocking it. Set port 587 with STARTTLS, turn on SMTP authentication, and test again.

Sohail Hussain|10 min read
Deliverability

SocketLabs "421 4.5.1 Too many errors" blacklist: how to fix it

`421 4.5.1 Too many errors, you have been temporarily blacklisted` means a SocketLabs server saw repeated auth or bad-address errors from your IP and paused it. Stop whatever is retrying, fix credentials and invalid recipients, clear the queue, and wait. The block usually lifts within minutes, but returns if retries resume.

Sohail Hussain|9 min read

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free