Welcome Guest, Not a member yet? Register   Sign In
$email->send() always returns false but the email is received
#1

Hey there,

so the problem is pretty much in the title, the $email->send() function always returns false, even though I receive the email without any problem on every email address (to, cc, bcc).
Code sample below. I'm using the latest branch of CI4.


Code:
$email = Services::email();
$config = new Email();

foreach($files as $file)
{
   $email->attach($file);
}

$email->setFrom($config->fromEmail, $config->fromName);
$email->setTo($toEmail);
$email->setCC($ccList);
$email->setBCC($bccList);
$email->setSubject($subject);
$email->setMessage($msg);
$email->setMailType('html');
$email->setHeader('MyCustomHeader', $myCustomHeaderValue);
$email->setNewline("\r\n");


if (!$email->send()) {
   $this->UndoEveryChanges();
   throw new \Exception("Email sending failed");
}


Any idea? Thanks in advance!
Reply


Messages In This Thread
$email->send() always returns false but the email is received - by xHeaven - 03-09-2020, 11:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB