0

I'm using CodeIgniter 4 to send email, using a simple function, like this:

$email = \Config\Services::email();

$email->setTo('[email protected]');
$email->setSubject('Just a test');
$email->setMessage('Simple email test');
if ($email->send()) {
    print('sucess Sending email.');
    die();
} else {
    $data = $email->printDebugger(['headers']);
    print('Error: ');
    print('<br>');
    print_r($data);
    die();
}

Well, if a send an email to a any valid gmail it works well and the email is send to it with no issues. But, if I tried any valid Outlook email I'm not able to send one. The Email has been sent but the [email protected] returned this:

Remote server returned '550 5.6.0 CAT.InvalidContent.Exception: ExchangeDataException, Decoding of header Subject failed+ADs

What do I need to do to send an email to Outlook.com like when I send to Gmail.com?

Thank you in advance. Nan Medeiros

P.S. Actually the postmaster return is bigger:

Remote server returned

'550 5.6.0 CAT.InvalidContent.Exception: ExchangeDataException, Decoding of header Subject failed+ADs- raw value: +AD0-?CHARSET?Q?+AD0-41+AD0-73+AD0-73+AD0-75+AD0-6E+AD0-74+AD0-6F+AD0-20+AD0-64+AD0-65+AD0-20+AD0-74+AD0-65+AD0-73+AD0-74+AD0-65?+AD0-; cannot handle content of message with InternalId 51715701212792, InternetMessageId [email protected].'

I've kept the code to a minimum to focus on the problem.

People, I add this code to my function and Everything works fine:

$email = \Config\Services::email();
$config['protocol'] = 'smtp';
$config['mailPath'] = '/usr/sbin/sendmail';
$config['charset']  = 'utf-8';
$config['wordWrap'] = true;

Actually I believe this ($config['charset'] = 'utf-8';) is the one that is missing.

1
  • My suggestion would be to use mail-tester.com - great tool and free for a few goes. that will hopefully get you in the right direction. Commented Dec 9, 2024 at 9:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.