Page 1 of 1

email - force to plain text ?

Posted: Sun May 25, 2008 7:10 pm
by sonichouse
Is there a way to force the encoding of emails to plain text.

Outlook is getting the mails as two attachments both ending in .dat.

The attachment looks like an encoded text.

Thanks.

/Steve

Posted: Sun May 25, 2008 7:19 pm
by sonichouse
OK, I butchered functions.inc.php to do

Code: Select all

if (0 && LANG_CHARSET == 'UTF-8') {
there must be a better way ?

Posted: Mon May 26, 2008 9:49 am
by garvinhicking
Hi!

Which mails? s9y always sends text mails.

Check your local SMTP if it is messing with the files? When UTf-8 encoding is needed, s9y only issues the proper Transfer-Encoding headers. But that does NOT result in attachments! Have a look at the Content-Type, s9y always sends text/plain, and no multiparts.

Regards,
Garvin

Posted: Mon May 26, 2008 12:11 pm
by sonichouse
garvinhicking wrote:Hi!

Which mails? s9y always sends text mails.

Check your local SMTP if it is messing with the files? When UTf-8 encoding is needed, s9y only issues the proper Transfer-Encoding headers. But that does NOT result in attachments! Have a look at the Content-Type, s9y always sends text/plain, and no multiparts.

Regards,
Garvin
The mails where from the contact plugin.

The SMTP is "nail" (pre-runner to mailx) and is running on my 32mb 266mhz NSLU2, so I am not surprised if it is the SMTP agent at fault.

Looks like nail is sending
User-Agent: nail 11.25 7/29/05
MIME-Version: 1.0
Content-Type: application/octet-stream
Content-Transfer-Encoding: quoted-printable
The machine is not up to installing a full smtp like sendmail, so I might just have to live with it.

I will see what other options I have.

Thanks,
Steve

Posted: Mon May 26, 2008 1:04 pm
by garvinhicking
Hi!

Yeah, this is the SMTP's issue then -- it changes the Content-Typ to an octet-stream, that's not what s9y instructs it to do.

So I'm afraid you'll need to use your patch (or see if you can configure nailx somehow) on your own...we cannot use it as a generic patch in s9y, because it would break more things than to repair with it -- all UTF-8 mails with special characters in it (umlauts etc.) would then not show up properly, if the base64-encoding were not provided.

Or you could even write your own plugin; s9y supports hooking in a plugin that does the mail delivery instead of using the internal routing system. You can use the "backend_sendmail" event for that, it gets the whole mail as an input array $eventData. The plugin then can do its delivery (with your custom modifications to the Headers) and simply switch $eventData['legacy'] to "false", so that the internal s9y routing is not executed.

HTH,
Garvin

Posted: Mon May 26, 2008 1:17 pm
by sonichouse
OK - resolved.

nail manual says
Nail expects input text to be in Unix format, with lines separated by newline (^J, \n) characters only. Non-Unix text files that use carriage return (^M, \r) characters in addition will be treated as binary data; to send such files as text, strip these characters e. g. by

tr -d '\015' <input | nail . . .
or fix the tools that generate them.
so I added

Code: Select all

//SPF Hack for nail
$maildata['message']=str_replace("\r\n", "\n", $maildata['message']);