splitbrain / dokuwiki-plugin-smtp

Send DokuWiki mails via a configured SMTP server
https://www.dokuwiki.org/plugin:smtp
12 stars 14 forks source link

email fails to send with Got: 550 5.6.0 Lone CR or LF in headers (see RFC2822 section 2.2) error #7

Open SQLServerIO opened 8 years ago

SQLServerIO commented 8 years ago

I'm using sparkpost.com to act as an smtp relay. It completes the handshake then fails with Got: 550 5.6.0 Lone CR or LF in headers (see RFC2822 section 2.2)

I've done some googling around but didn't find anything specific to dokuwiki. I have every field properly filled out in the configuration.

goldfire commented 8 years ago

I'm seeing the same thing with both this plugin and the older SwiftMailer plugin.

yivi commented 8 years ago

Did someone got around this?

yivi commented 8 years ago

Problem not with plugin, but with dokuwiki mailer, which is using LN as EOL for the mail message, which some servers do not like at all.

I added if(!defined('MAILHEADER_EOL')) define('MAILHEADER_EOL',"\r\n"); in my local settings, and problem got fixed. :)

splitbrain commented 7 years ago

What mailserver are you guys using?

dan-el commented 7 years ago

Hi,

We are using Office 365 as mailserver and the server recently started generating NDRs because of BareLF errors.

I quickly fixed this using the following line of code in the plugin's action.php file (Fixe bare LF).

This is copied from a phpBB forum entry which you can find here: https://www.phpbb.com/community/viewtopic.php?f=46&t=1489875&p=8876785

Here's the short snippet.

        // prepare the message
        /** @var Mailer $mailer Our Mailer with all the data */
        $mailer = $event->data['mail'];
        $body = $mailer->dump();  // this also prepares all internal variables of the mailer
    $body = preg_replace("#(?<!\r)\n#si", "\r\n", $body); // Fix bare LF
        $rcpt   = $event->data['to'] . ',' .
                  $event->data['cc'] . ',' .
crovaxon commented 7 years ago

Hello,

I was receiving a 451 "See http://pobox.com/~djb/docs/smtplf.html." error when trying to send a test E-Mail after configuring the plugin. Using the same code snippet @dan-el posted I was able to successfully send the E-Mail.

CrazyCodeUK commented 4 years ago

While this issue still exists in dokuwiki it would be useful to integrate the fix in post by @dan-el