SMTP Error: Data Not Accepted

I’m getting the error “SMTP Error: Data Not Accepted” when logging into the Kirby panel, but I can send tests from the server no problem, and verified everything is functioning with sendgrid by doing telnet send tests.

This is the config I am using which worked sending from command line on the server.

return [
    'auth' => [
        'methods' => 'code'
    ],
 'email' => [
    'transport' => [
      'type' => 'smtp',
      'host' => 'smtp.sendgrid.net',
      'port' => 2525,
      'security' => false,
      'auth' => true,
      'username' => 'apikey',
      'password' => "xxx"
    ]
  ],
    'url' => 'https://socu.azurewebsites.net'
];

In Sendgrid I have verified the domain so it accepts all email sent from the domain.

Check if you find any details in your PHP or server error logs.

What exactly did you try? And with which from address? Wondering if you have to set a specific sender…

1 Like

Sent from noreply@[mydomain] - what protocol is Kirby using to send the mail? I’m using Azure app services and it might not be installed…

Also if I put this in a template and go to the page it sends the email no issue. So there seems to be something not working using the 2FA in the panel.

try {
  $kirby->email([
    'from' => 'no-reply@domain.org',
    'replyTo' => 'no-reply@domain.org',
    'to' => 'athread@domain.org',
    'subject' => 'Welcome!',
    'body'=> 'It\'s great to have you with us',
  ]);
} catch (Exception $error) {
  echo $error;
}

Kirby uses the SMTP protocol to send the email. The auth logic internally uses $kirby->email() as well.

Could you try setting the auth.challenge.email.from option to an email address that you know is accepted?

1 Like

That worked, the weird thing is that Sendgrid should have accepted anything from my domain. This is the syntax in-case anyone runs into this in the future. Taken from here - auth | Kirby CMS


  'auth' => [
      'methods' => [
            'password' => ['2fa' => true]
        ],
      'challenge' => [
          'timeout' => 5 * 60, // 5 minutes
          'email' => [
              'from'     => 'no-reply@domain.org'
          ]
      ]
  ],