Deliverability

Amazon SES SMTP credentials not working: fix the password

Amazon SES SMTP credentials fail when you paste an IAM secret access key as the password. The username is the IAM access key ID, but the password must be derived from the secret key for one specific region. Generate SMTP credentials in the SES console, or run the conversion script below.

Sohail HussainSohail Hussain9 min read

Short answer

  • Your AWS secret access key is not an SES SMTP password. Generate SMTP credentials in the SES console, or convert the secret key into an SMTP password for the exact region you send from.
  • Match the server name to the region the password was made for, and for a converted key use the access key ID as the SMTP user name.

You gave Thunderbird, Outlook or another mail client the credentials of an IAM user that has a sending policy. The login fails with something like 535 Authentication Credentials Invalid or a vague "incorrect password" message. The IAM user and its policy are fine. The password field expects a different value.

Why SES rejects the credentials

535 is the standard SMTP "authentication failed" reply. It does not say whether the user name or the password was wrong, and mail clients usually paraphrase it as "incorrect password" or "authentication failed".

The most common cause is the one in the title. AWS's SMTP troubleshooting page lists incorrect credentials as a common cause: the credentials you use for the SMTP endpoint are different from your AWS credentials. An IAM user with a sending policy looks like it should work everywhere, so people paste the secret access key into the password field. It works for API calls and fails over SMTP.

The second most common cause is the region. SMTP passwords are derived using a region, so a password made for us-east-1 fails against the eu-west-1 endpoint even though the secret key is the same.

Less common causes are a stray space or newline pasted with the password, an IAM key that was deactivated or rotated, a client set to OAuth2 instead of a plain password login, and a firewall that blocks the port (which looks like a connection failure, not a 535).

CauseSymptomFix
Secret access key typed as passwordImmediate 535Fix 1 or Fix 2
Password made for another regionWorks in one region, 535 in anotherRegenerate for the endpoint's region
Extra whitespace or truncated paste535 with a correct-looking passwordRe-copy the whole value
Key inactive or deletedWorked before, 535 nowCheck key status in IAM, create a new key
Client uses OAuth2Client never sends a passwordSwitch to normal password login
Port blocked on your networkTimeout, no 535 at allTest the port (Fix 3)

Fix 1: generate SMTP credentials in the console

This is the easiest route when you do not need to keep an existing IAM user.

  1. Open the SES console in the region you will send from.
  2. Choose SMTP settings in the left navigation pane.
  3. Choose Create SMTP credentials. The IAM console opens.
  4. In the User Name field, type a name or accept the default, then choose Create user.
  5. Select Show under the SMTP password, then choose Download .csv file or copy the values. You cannot view or save the credentials after you close the dialog box.

The IAM user doing this needs permissions such as iam:CreateUser, iam:CreateGroup, iam:PutGroupPolicy, iam:AddUserToGroup and iam:CreateAccessKey. Without them, creation can fail or leave you with credentials that lack the sending policy.

AWS's developer guide now also describes a newer route. It lists creating SMTP credentials using Mail Manager as the recommended option, alongside obtaining SMTP credentials using IAM. With either type, enter the endpoint from your SMTP credentials as the hostname instead of guessing it. Menu labels change, so if you cannot find a button, search the SES console for "SMTP settings".

Fix 2: convert an existing IAM secret key

Use this when you already have an IAM user and still have its secret key. The SMTP user name is the access key ID, so you only need to generate the password.

The user also needs permission to send. The conversion signs the action SendRawEmail, so a minimal policy is:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ses:SendRawEmail",
      "Resource": "*"
    }
  ]
}

Then derive the password with the documented version 4 algorithm:

import hmac, hashlib, base64, sys

def sign(key, msg):
    return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest()

def smtp_password(secret_access_key, region):
    sig = sign(("AWS4" + secret_access_key).encode("utf-8"), "11111111")
    sig = sign(sig, region)
    sig = sign(sig, "ses")
    sig = sign(sig, "aws4_request")
    sig = sign(sig, "SendRawEmail")
    return base64.b64encode(bytes([0x04]) + sig).decode("utf-8")

print(smtp_password(sys.argv[1], sys.argv[2]))
  1. Save the script as ses_smtp.py.
  2. Run python ses_smtp.py YOUR_SECRET_KEY us-east-1, replacing the region with the one you will connect to.
  3. Copy the single line of output. That is your SMTP password.
  4. Use the IAM access key ID (20 characters) as the user name.

Run it on your own machine. Do not paste a live secret into an online converter. If you have lost the secret key, you cannot recover it; create a new access key for the IAM user, or use Fix 1. AWS's page on obtaining SES SMTP credentials with IAM has the reference version of the algorithm, so compare against it if your output does not work.

Do not reuse the secret key

If the IAM secret key ended up in a mail client, a chat or a screenshot, rotate it in IAM. A mail client is not a safe place to store it.

Fix 3: check the connection settings

Correct credentials still fail with the wrong settings. Check each one.

  1. Server: email-smtp.{region}.amazonaws.com, in the same region the password was made for, for example email-smtp.us-east-1.amazonaws.com. If your credentials came with an endpoint, use that one.
  2. Port and encryption: AWS documents ports 25, 587 or 2587 for STARTTLS, and 465 or 2465 for TLS Wrapper. Port 587 with STARTTLS is the safe default for most mail clients; 465 is the implicit-TLS choice.
  3. Avoid port 25 from EC2: Amazon EC2 restricts outbound email traffic over port 25 by default. AWS also says ports 465 and 587 are not restricted.
  4. User name: the SMTP user name from the credentials, which for a converted key is the access key ID. It is not the IAM user name and not your AWS sign-in email.
  5. Whitespace: a trailing space or newline copied with the password is a frequent cause. The password can contain + and /, so select it whole.
  6. Key status: in IAM, confirm the access key is Active.
  7. Authentication method: choose normal password or plain login, not OAuth2.

To separate a network problem from a credential problem, AWS suggests a connection test. In its SMTP troubleshooting page it gives a telnet command against your regional endpoint and the port you are trying (typically 465, 587, 2465 or 2587). It adds that if you cannot connect using telnet or openssl, something in your network, such as a firewall, is blocking the port. On Windows, AWS's connection-testing page uses Test-NetConnection -Port 587 -ComputerName email-smtp.us-west-2.amazonaws.com, with your own endpoint swapped in. See AWS's SES SMTP issues page for the exact commands.

Test with OpenSSL

A plain TCP test does not check TLS. AWS notes that Test-NetConnection does not test whether you can make an implicit or explicit SSL connection, so use OpenSSL for that.

When login works but sending fails

Once authentication passes, a different class of error appears, and people often mistake it for a credential problem.

  • 554 Message rejected: Email address is not verified: the From address or domain is not a verified identity in that region. If your account is still in the SES sandbox, the recipient address must be verified too. Request production access in the SES console.
  • A quota or throttling rejection: you hit the daily limit or per-second rate in that region.
  • Accepted but landing in spam: that is a sender authentication issue (SPF, DKIM, DMARC), not a login issue.

Checklist before you try again

  • The password was generated or converted, never copied from the IAM secret key field.
  • The region in the server name matches the region used for the password.
  • The user name is the one that belongs to those credentials.
  • No leading or trailing spaces in either field.
  • The IAM key is Active and the user can send (ses:SendRawEmail).
  • The client uses password login on port 587 (STARTTLS) or 465 (TLS Wrapper).

If nothing works

Contact AWS Support when a freshly generated credential pair still returns 535 on a port you have confirmed is reachable. Include the region, the endpoint and port, the time of the attempt with timezone, the exact server reply, and the access key ID or SMTP user name. Never send the secret key or the SMTP password.

Subject: SES SMTP authentication fails with 535 in {region}

Hello,

SMTP login to email-smtp.{region}.amazonaws.com on port 587 (STARTTLS) fails with:
535 Authentication Credentials Invalid

Details:
- AWS account ID: {account-id}
- SMTP user name / access key ID: {AKIA...}
- Region: {region}
- Time of attempt: {date, time, timezone}
- Credentials created via: {SES console / converted from IAM secret key}
- Already tried: regenerated credentials, confirmed region matches,
  checked for whitespace, tested connectivity with telnet/openssl

Please check whether the SMTP credentials are valid for this region.

Thank you,
{name}

Common questions

Can I use the same SMTP password in several regions?

No. The password is derived with a region, so the same secret key gives a different password for each one. Generate or convert a set for every region you send from.

Is the SMTP user name my IAM user name?

No. For console-created credentials, use the SMTP user name shown or downloaded with the password. For a converted key, it is the access key ID.

Can I view the SMTP password again later?

Not in the IAM console flow, because the credentials cannot be viewed or saved after you close the dialog box. Create a new set instead.

Does this apply to other apps that send through SES?

Yes. Any app or tool that connects to SES over SMTP needs the SMTP password and the matching regional endpoint, not the IAM secret key.

deliverabilityamazon-ses
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

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

Related Articles

Deliverability

Amazon SES account under review: bounce rate pause fix

When Amazon SES puts your account under review or pauses sending, your bounce or complaint rate crossed its limits. Stop sending to the bad segment, suppress every bounce and complaint through SNS events, keep sending small volumes to clean recipients, and answer the AWS case with documented causes and fixes.

Sohail Hussain|10 min read
Deliverability

Amazon SES emails going to spam when SPF, DKIM and DMARC pass

When SES mail lands in Gmail spam with SPF, DKIM and DMARC passing, authentication is rarely the cause. The usual culprits are a new domain sent at full volume, a gmail.com From address, links Gmail doesn't trust, or low engagement. Read the headers first, then ramp volume and fix content.

Sohail Hussain|10 min read
Deliverability

SES "Email address is not verified" but it shows verified

Amazon SES returns "Email address is not verified" when the identity isn't verified in the region your code calls. Identities are per region, so compare the region in the error, the SDK client and the console, then verify the identity there or change the client's region.

Sohail Hussain|9 min read
Deliverability

Amazon SES production access denied: how to get approved

When Amazon SES denies production access with "reasons cannot be provided due to security reasons", reply on the same support case with specifics: use case, list source and consent, bounce and complaint handling through SNS, opt-out method, and a sample email. Ask for a second review. If that fails, use another sender.

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