To answer my own questions, the error info is all available once you figure it out.
Note that this applies to MODx Revolution.
This will give you the error info. It’s not as helpful as it might be because SMTP errors are not put into the ErrorInfo variable, but you do find out that the "From" field caused the failure. You also get a lexicon failure because the mailer still has the old-style language files.
echo $this->modx->mail->mailer->ErrorInfo;
To get more info, I worked this out:
function _my_mail(blah, blah, blah) {
/* set up for mailing code deleted */
/* send */
if (!$this->modx->mail->send()) {
/* if debug is on, resend with error reporting */
if($this->debug) {
if ($this->use_SMTP) {
echo "<b>SMTP errors:</b><br />";
$this->modx->mail->mailer->SMTPDebug = 2;
$this->modx->mail->send();
}
echo '<br /><br /><b>' . "Mailer ErrorInfo:</b><br />";
die($this->modx->mail->mailer->ErrorInfo);
}
die('<b>' . $this->modx->lexicon('mail-failure') . '</b>');
}
$this->modx->mail->reset();
}
This gets you very detailed information on the failure (if you want even more -- too much usually --, you can set SMTPDebug = 4).
For the curious,
[email protected] manages to sneak by almost all good validation code because of the exception for two-letter country code domains. In my case, the remote SMTP host flagged it as a bad domain and refused to send the mail, either because it’s not legal or because it doesn’t exists -- not sure which.
I’m not sure what would happen with mail() as opposed to SMTP becuase I don’t have Revolution installed anywhere with mail() working. I did try sending from an 0.9.6 site using mail() and that return email appeared to work fine but the mail never arrived, so I imagine it’s the same.
[Update] The messages are actually sent when using mail() -- at least in 0.9.6 -- they just go into the trash if you previously set a filter a long time ago to put them there and then forgot you did that.