Autor Thema: BASE64 to Plain Text  (Gelesen 10270 mal)

Offline RVRoadTrip

  • Nano
  • **
  • Beiträge: 50
  • Opencaching.US
    • Opencaching.US
BASE64 to Plain Text
« am: 11. Dezember 2010, 15:01:10 »
Can someone familiar with the code tell me how to have all system emails sent via plain text and not BASE64?  Here in the US, we do not need BASE64 and it is causing garbled emails for users.  Thanks!

Jerry
OCUS Admin
Jerry
Former OC US Admin

Offline OlofL

  • Nano
  • **
  • Beiträge: 70
  • OC SE Team
Re: BASE64 to Plain Text
« Antwort #1 am: 11. Dezember 2010, 17:12:05 »
I've not tested this myself, but try this:
In lib/clicompatbase.inc.php around line 47 change
   mb_language('uni');
to
   mb_language('en');

Offline alamostrail

  • Nano
  • **
  • Beiträge: 20
  • QVI.SIM.SCIES.SI.PAR.OPVS.FACERE.CONABERIS.
Re: BASE64 to Plain Text
« Antwort #2 am: 11. Dezember 2010, 17:44:34 »
Sorry I can not help


oliver

  • Gast
Re: BASE64 to Plain Text
« Antwort #3 am: 11. Dezember 2010, 19:57:45 »
Can someone familiar with the code tell me how to have all system emails sent via plain text and not BASE64?  Here in the US, we do not need BASE64 and it is causing garbled emails for users.

can you look in your source code (register.php) what mail-method is used?
mb_send_mail() or mail()

Offline sp2ong

  • Nano
  • **
  • Beiträge: 63
  • OC PL Team
    • OpenCaching Poland
Re: BASE64 to Plain Text
« Antwort #4 am: 11. Dezember 2010, 20:08:36 »
Hi,

OC PL/US/UK/SE/JP/NL

use:

mb_send_mail
« Letzte Änderung: 11. Dezember 2010, 20:12:15 von sp2ong »
Waldek sp2ong OC PL

oliver

  • Gast
Re: BASE64 to Plain Text
« Antwort #5 am: 11. Dezember 2010, 20:14:39 »
Okay, switching to simple mail() command will help in this case, i think.
However, database content is stored in UTF-8 and you will get charset troubles (instant or in near future).

Maybe this is a easy solution:
http://www.php.net/manual/de/function.mail.php#27997
(the comment from gordon at kanazawa-gu dot ac dot jp)

Offline sp2ong

  • Nano
  • **
  • Beiträge: 63
  • OC PL Team
    • OpenCaching Poland
Re: BASE64 to Plain Text
« Antwort #6 am: 11. Dezember 2010, 20:18:14 »
But generally our OC PL users don't report problem which exist on OC US
Waldek sp2ong OC PL

oliver

  • Gast
Re: BASE64 to Plain Text
« Antwort #7 am: 11. Dezember 2010, 20:34:59 »
But generally our OC PL users don't report problem which exist on OC US

Here in germany we have sometimes problems with mails caught by spam filters - but when they arrive, the mails are readable ...
... maybe the charset of e-mail template is wrong?

Offline OlofL

  • Nano
  • **
  • Beiträge: 70
  • OC SE Team
Re: BASE64 to Plain Text
« Antwort #8 am: 11. Dezember 2010, 23:25:38 »
oc.se has occasionally got reports from users of base64 mail not being decoded by their e-mail clients. It is rare, and for the same user it nearly always works. Perhaps something is wrong in the headers? The default for mb_send_mail is to send base64, the mb_langague should switch the encoding. Unless the mb_language statement has any effect, then switching to mail() should have, but then you will probably need to encode it yourself.

Offline RVRoadTrip

  • Nano
  • **
  • Beiträge: 50
  • Opencaching.US
    • Opencaching.US
Re: BASE64 to Plain Text
« Antwort #9 am: 14. Dezember 2010, 16:44:14 »
The problem is the garbled emails. We have many users who report receiving them and who knows how many receive them but simply do not notify us and they do not return to the site. We do not wish to lose any "customers" due to this.
Jerry
Former OC US Admin

Offline OlofL

  • Nano
  • **
  • Beiträge: 70
  • OC SE Team
Re: BASE64 to Plain Text
« Antwort #10 am: 15. Dezember 2010, 08:25:26 »
Which version of php are you using? There seems to be differencens between versions regarding this.

Also, it would be great if you could post the full headers from a messed up mail, to try to figure out why the clients fails to handle it.

Offline RVRoadTrip

  • Nano
  • **
  • Beiträge: 50
  • Opencaching.US
    • Opencaching.US
Re: BASE64 to Plain Text
« Antwort #11 am: 15. Dezember 2010, 23:31:04 »
This is the bug report thread about it on the OCUS site: http://forum.opencaching.us/viewtopic.php?f=31&t=199

For the full info on the PHP version, etc, see this page: http://www.opencaching.us/0.php

Sample email:

From: Opencaching US <notify@opencaching.us>
Reply-To: noreply@opencaching.us
Mime-Version: 1.0
Content-Transfer-Encoding: BASE64
Message-Id: <20101119010001.E766EC21A@opencaching.us>
Date: Fri, 19 Nov 2010 01:00:01 +0000 (UTC)
Return-Path: www-data@opencaching.us
X-OriginalArrivalTime: 19 Nov 2010 01:00:01.0927 (UTC) FILETIME=[185BF170:01CB8785]

SGVsbG8gaWRyYXRoZXJiZWludGhld29vZHMhDQoNClRoZSBmb2xsb3dpbmcgbmV3IGNhY2hlIGhh
cyBiZWVuIHBsYWNlZCB3aXRoaW4geW91cg0Kbm90aWZpY2F0aW9uIHJhZGl1czoNCg0KDQoxOC4x
MS4yMDEwLCAgVGFwZSB3b3JtIHBsYWNlZCB0aGUgbmV3IGNhY2hlOiAiSC5BLkMuIC1PcmllbnRl
ZXJpbmciLg0KRGlzdGFuY2U6IDc3LjggbWkgDQpUeXBlOiBNdWx0aWNhY2hlDQpTaXplOiBOb3Jt
YWwNCg0KTGluazogaHR0cDovL3d3dy5vcGVuY2FjaGluZy51cy92aWV3Y2FjaGUucGhwP3dwPU9V
MDE3MA0KDQoNClRvIGVuYWJsZSBvciBkaXNhYmxlIG5vdGlmaWNhdGlvbnMgYW5kIHRoZSBzaXpl
IG9mIHRoZSByYWRpdXMNCmluIHlvdXIgcHJvZmlsZSwgcGxlYXNlIHZpc2l0Og0KaHR0cDovL3d3
dy5vcGVuY2FjaGluZy51cy9teXByb2ZpbGUucGhwDQoNClRoYW5rIHlvdSENClRoZSBPQyBVUyBU
ZWFtIA0KDQo=
Jerry
Former OC US Admin

Offline OlofL

  • Nano
  • **
  • Beiträge: 70
  • OC SE Team
Re: BASE64 to Plain Text
« Antwort #12 am: 16. Dezember 2010, 08:11:01 »
I can see in the souce code that there is actually a line in the email header missing for notifications. The same header from
util.sec/email_sender/email_sender.php
         $headers = "Content-Type: text/plain; charset=utf-8\n";
but this header is missing in
util.sec/notification/run_notify.php

I suspect that the a missing header could mess it up for some email-clients since they don't know that it is utf-8 that will arrive.

There is actually a mb_encode_mimeheader() missing in the send_email.php, but due to another bug it doesn't make any difference.

If you've got a test environment try exchanging the line (around 102) in runnotify with this:

      $email_headers = "Content-Type: text/plain; charset=utf-8\r\n";
      $email_headers .= 'From: "' . mb_encode_mimeheader( $mailfrom ) . '" <' . $mailfrom . '>';
      $email_headers .= "Reply-To: "' . $mailfrom . '"\r\n";

If you cannot test it yourself, I can setup a test environment for this.

Exactly the same problem exists for util.sec/watchlist/runwatch.php and also for htdocs/chowner.php, so change it there also.

Offline DudleyGrunt

  • Nano
  • **
  • Beiträge: 87
  • Happy Trails!
    • Twitter
Re: BASE64 to Plain Text
« Antwort #13 am: 16. Dezember 2010, 15:48:11 »
Thanks, OlofL.  RVRoadTrip will need to be the one to implement this, but I'm definitely hoping it solves our problem at OCUS.
Dave - OC US Admin

Offline OlofL

  • Nano
  • **
  • Beiträge: 70
  • OC SE Team
Re: BASE64 to Plain Text
« Antwort #14 am: 16. Dezember 2010, 19:23:00 »
I'll keep my fingers crossed - but the report I got when this happened at oc.se it was when a user sent a mail to another user, and in that case the headers seem ok.

But then, if this doesn't solve the problem, we still have the option to send plain text mails (with some development). However this cannot be used by anyone but you or .uk becacuse of all our strange letters.