Ошибка 535 authentication credentials invalid

In the code below I tried 2 combinations

  1. The User (refer to attached image), the password
  2. The Access ID and the Access Key

Both gave the same error. I ran this code in my eclipse environment in my home network.

Error

Attempting to send an email through the Amazon SES SMTP interface...
The email was not sent.
Error message: 535 Authentication Credentials Invalid

Amazon SES Users

Code

public class amazon_ses_smtp_test {

    static final String FROM = "someone@myemail.com";   // This has been verified on the Amazon SES setup
    static final String TO = "justanyone@anydomain";  // I have production access

    static final String BODY = "This email was sent through the Amazon SES SMTP interface by using Java.";
    static final String SUBJECT = "Amazon SES test (SMTP interface accessed using Java)";

    static final String SMTP_USERNAME = "tried username and tried accesskey here";
    static final String SMTP_PASSWORD = "tried the password and the access key"; 

    static final String HOST = "email-smtp.us-east-1.amazonaws.com";    

    static final int PORT = 25;

    public static void main(String[] args) throws Exception {

        Properties props = System.getProperties();
        props.put("mail.transport.protocol", "smtp");
        props.put("mail.smtp.port", PORT); 

        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.starttls.required", "true");

        Session session = Session.getDefaultInstance(props);

        MimeMessage msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress(FROM));
        msg.setRecipient(Message.RecipientType.TO, new InternetAddress(TO));
        msg.setSubject(SUBJECT);
        msg.setContent(BODY,"text/plain");

        Transport transport = session.getTransport();

        try
        {
            System.out.println("Attempting to send an email through the Amazon SES SMTP interface...");

            transport.connect(HOST, SMTP_USERNAME, SMTP_PASSWORD);
            transport.sendMessage(msg, msg.getAllRecipients());
            System.out.println("Email sent!");
        }
        catch (Exception ex) {
            System.out.println("The email was not sent.");
            System.out.println("Error message: " + ex.getMessage());
        }
        finally
        {
            transport.close();          
        }
    }
}

asked Jan 30, 2014 at 9:22

Siddharth's user avatar

6

Important

Your SMTP user name and password are not the same as your AWS access key ID and secret access key. Do not attempt to use your AWS credentials to authenticate yourself against the SMTP endpoint. For more information about credentials, see Using Credentials With Amazon SES.

Here’s the link: http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html

answered Feb 19, 2014 at 9:56

Marvin Saldinger's user avatar

Marvin SaldingerMarvin Saldinger

1,2701 gold badge15 silver badges33 bronze badges

1

The issue is fixed in our case with the following : The AWS SMTP had special characters in its credentials . The credentials have to be url encoded and then provided in the configuration.

answered Mar 30, 2016 at 5:46

user19's user avatar

user19user19

1611 silver badge2 bronze badges

4

If you’re using Terraform, you can use the following .tf file so that you can get the proper data

resource "aws_iam_user" "smtp_user" {
  name = "smtp_user"
}

resource "aws_iam_access_key" "smtp_user" {
  user = aws_iam_user.smtp_user.name
}

data "aws_iam_policy_document" "ses_sender" {
  statement {
    actions   = ["ses:SendRawEmail"]
    resources = ["*"]
  }
}

resource "aws_iam_policy" "ses_sender" {
  name        = "ses_sender"
  description = "Allows sending of e-mails via Simple Email Service"
  policy      = data.aws_iam_policy_document.ses_sender.json
}

resource "aws_iam_user_policy_attachment" "test-attach" {
  user       = aws_iam_user.smtp_user.name
  policy_arn = aws_iam_policy.ses_sender.arn
}

output "smtp_username" {
  value = aws_iam_access_key.smtp_user.id
}

output "smtp_password" {
  value = aws_iam_access_key.smtp_user.ses_smtp_password_v4
}

This will output the user name and password needed for SMTP authentication for the region.

This will do the proper computation for the password.

answered May 4, 2020 at 20:49

Archimedes Trajano's user avatar

3

I found that it’s not enough to create the SES SMTP credentials. After you do that, go to Domains, select your domain, Identity Policies, Policy Generator. You’ll need to get the SMTP user’s ARN, which you can find in the IAM section.

answered Nov 20, 2019 at 15:46

Jose Solorzano's user avatar

Obtaining Your Amazon SES SMTP Credentials

You need an Amazon SES SMTP user name and password to access the Amazon SES SMTP interface. You can use the same set of SMTP credentials in all AWS regions.

Important

Your SMTP user name and password are different from your AWS access key ID and secret access key. For more information about credentials, see Using Credentials With Amazon SES.

Follow this doc to get SMTP credentials

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html

answered Nov 19, 2018 at 16:40

Raghvendra Parashar's user avatar

Is your email application throwing Amazon SES SMTP 535 Authentication Credentials Invalid error?

Amazon offers the Simple Email Service as a quick option to send emails.

However, sending emails often shows authentication errors due to wrong credentials, account suspension, etc.

At Bobcares, we help AWS customers to send emails correctly as part of our AWS Support Services.

Today, we’ll see how we fix the credentials invalid error with Amazon SES.

Where does Amazon SES SMTP 535 Authentication Credentials Invalid error show up?

In general, Amazon SES works as a quick way to send emails from applications. In this model, the user need not have to maintain their mail servers. It allows sending emails from the user’s domain name itself. That’s why many users make use of Amazon SES to send mails.

That raises the question, where do users find Amazon SES useful?

The common scenarios include sending emails from the command line, SMTP mail programs, applications like WordPress, eclipse, etc.

Recently, a WordPress customer reported the SMTP failed error in his email form as:

Amazon SES SMTP 535 authentication credentials invalid

Common causes of Amazon SES SMTP 535 Authentication Credentials Invalid error

Amazon SES uses an SMTP login to authenticate a connection.

Let’s now check the common causes for email failure using SES.

Incorrect SMTP login details

One of the top reasons for SMTP failure can be invalid SMTP login details. Many AWS users provide their AWS IAM username and password in their email application. But, this is different from the SES SMTP login details. For the emails to work, users have to give the correct SES login details.

Special characters in credentials

Similarly, the special characters in SMTP credentials can also create problems while sending emails. The credentials require URL encoding and then provide in the configuration.

Suspension of sending privileges

Likewise, suspension of Amazon Simple Email Service (Amazon SES) can also cause a 535 error. SES is a mail service that has many users. Therefore, Amazon continuously monitors the number of emails sent from each user. If any of the users send bulk emails or spam, there will be resource abuse. This can affect other users on the same server.  Here, Amazon suspends the sending privileges of the suspicious account.

It is always recommended to keep a close watch on your email activity to avoid suspension of service. As a best practice, we always enable authentication with SMTP. In this way, only authorized users can send emails.

How we fixed Amazon SES 535 error?

We’ll now move on and check how we resolved the 535 error with Amazon SES.

Checking Amazon SES status

As the first step, our Support Engineers verified the status of Amazon SES service. This helped us to rule out the possibility of account suspension.

Verifying SMTP login

Further, we verified whether the customer was using the correct SMTP login details.

For this, we logged in to the customer’s AWS account, and selected “AWS Management Console”. Then we opened Amazon SES console.

In the navigation pane, we selected SMTP Settings. In the content pane, we clicked Show User SMTP Credentials. Thus, we could see the current SMTP credentials.

If the user account was found missing, we click on Create My SMTP Credentials. That will automatically create a login with default values.

Likewise, to change your SMTP password, we delete the existing SMTP user in the IAM console. Then, complete the procedures to generate a new set of SMTP credentials.

Validating SMTP connection

Moving on, we validated the SMTP connection from the SES console. It worked fine.

However, the settings in the WP SMTP plugin in WordPress was incorrect. Therefore, we corrected the login details and the error was fixed.

We always make sure to check for special characters in the password.

[Trouble connecting with Amazon SES login? We can help you.]

Conclusion

In short, Amazon SES SMTP 535 Authentication Credentials Invalid occurs due to wrong login details, suspended SES account, etc. Today, we saw how our AWS Experts checked and fixed email sending via Amazon SES.

Get 24×7 monitoring for your AWS servers

There are proven ways to get even more out of your AWS Infrastructure! Let us help you.

Spend your time in growing business and we will take care of AWS Infrastructure for you.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

What’s Causing This Error

SMTP error 535 indicates an issue with the client’s authentication with the email server. It may be the result of many issues, some of the most common causes being:

  1. Invalid credentials.
  2. Disabled account.
  3. Invalid or incompatible connection encryption settings.
  4. Invalid or incompatible Authentication Methods.

Solution — Here’s How To Resolve It

Depending on the cause of this error, the user may need to take different approaches when attempting to fix this error.

  1. The user must validate the credentials used to login into the email server.
  2. Check if the account is in working order and is not disabled.
  3. Validate the SMTP configuration to check if the connection encryption and authentication settings are compatible with the email server.

When an SMTP mail server responds to an attempted email delivery with the error message:

535 5.7.8 Authentication credentials invalid
This indicates that the mail server refused to accept the message because the client supplied invalid or insufficient authentication credentials.

You should check the username & password (or other authentication method) you are using to authenticate with the SMTP server before attempting to re-send the email.

This is basically because credentials is not correct !!

May be this will help you !!

535 Authentication failed. Restarting authentication process.

If a SMTP client authenticates but the username or password is incorrect, or the account is disabled, hMailServer sends this error message to the client.

http://support.qualityunit.com/156325-Email-is-not-sent-because-of-failed-authentication

SMTP error 535 authentication failed in roundcube

SMTP Error (435): Authentication failed

If you face SMTP error 535 Authentication Failed while sending an email from round cube, then you can check the following things.

[[email protected] ~]# vi /usr/local/cpanel/base/3rdparty/roundcube/config/main.inc.php

and changed

$rcmail_config['smtp_user'] = ‘%u’;
to
$rcmail_config['smtp_user'] = ”;

Related videos on Youtube

Fix Nodemailer Not Sending Emails(535 - Authentication Failed)

02 : 02

Fix Nodemailer Not Sending Emails(535 — Authentication Failed)

Enable SMTP mail with gmail

01 : 28

Enable SMTP mail with gmail

5.7.8 username and password not matched | smtp mageplaza issue resolved #magento2 #php

02 : 31

5.7.8 username and password not matched | smtp mageplaza issue resolved #magento2 #php

How to remove authentication error from gmail for webmail

01 : 50

How to remove authentication error from gmail for webmail

Django SMTPAuthenticationError at /  (535, b'5.7.8 Username and Password not accepted)

06 : 27

Django SMTPAuthenticationError at / (535, b’5.7.8 Username and Password not accepted)

#5 - Sửa lỗi SMTP Error: Could not authenticate trên SMTP Gmail - Sử dụng Gmail API gửi mail 100%

30 : 41

#5 — Sửa lỗi SMTP Error: Could not authenticate trên SMTP Gmail — Sử dụng Gmail API gửi mail 100%

Trung No Code — Công nghệ & Cuộc sống

SMTP password rotation for Amazon SES User | 535 Authentication Credentials Invalid

03 : 20

SMTP password rotation for Amazon SES User | 535 Authentication Credentials Invalid

Comments

  • I am using jango smtp setting in my project.

    Below is my code:

    funcation sendmail()
    {
    
    $this->Email->smtpOptions = array(
    
      'timeout' => '30',
    
      'port' => '25', 
    
      'host' => 'relay.jangosmtp.net',
    
      'username' => 'xxxx',
    
      'password' => '1234567'
    
    );
    }
    

    sendmail function gives the following error:

    SMTP Error: 535 5.7.8 Authentication credentials invalid
    

    What may be the reason?

    • what jango documentation are you using? can you link us?

Recents

Related

Понравилась статья? Поделить с друзьями:
  • Ошибка 550 your mailer sends invalid headers ошибка outlook
  • Ошибка 5343 на мерседесе актрос
  • Ошибка 550 spam message rejected
  • Ошибка 533 что это значит
  • Ошибка 550 requested action not taken mailbox unavailable