Default mail encoding?

Discussion corner for Developers of Serendipity.
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Default mail encoding?

Post by Don Chambers »

I have 1.5 beta running on a few sites, all of which are on the same server. All of those sites send email in a garbled manner (using MS Outlook 2003)... they look something like this:

Code: Select all

From: "don chambers" <don@example.com>
Reply-To: "don chambers" <don.chambers@example.com>
X-Mailer: Serendipity/1.5-beta2
X-Engine: PHP/5.3.0
Message-ID: <0607d6703ac33cfe80b61ad15abb1f2b@www.example.com>
MIME-Version: 1.0
Precedence: bulk
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
Date: Sat,  5 Dec 2009 11:53:06 -0500 (EST)

QSBuZXcgY29tbWVudCBoYXMgYmVlbiBwb3N0ZWQgb24geW91ciBibG9nICJCYXJuZXN2aWxsZS5j
b20iLCB0byB0aGUgZW50cnkgZW50aXRsZWQgIkNvbnRhY3QgVXMiLgoKVXNlciBJUC1hZGRyZXNz
OiAyNC4xNC4xNTEuMTE2CgpGaWVsZCAgJ05hbWUnOiBkb24gY2hhbWJlcnMKRmllbGQgICdFbWFp
bCc6IGRvbi5jaGFtYmVyc0BvcHRpb25hbC1uZWNlc3NpdHkuY29tCkZpZWxkICAnTWVzc2FnZSc6
IEp1c3QgYSB0ZXN0IC0gZGlzcmVnYXJkLgoKLS0tLQoKLS0gCkJhcm5lc3ZpbGxlLmNvbSBpcyBw
b3dlcmVkIGJ5IFNlcmVuZGlwaXR5LgpUaGUgYmVzdCBibG9nIGFyb3VuZCwgeW91IGNhbiB1c2Ug
aXQgdG9vLgpDaGVjayBvdXQgPGh0dHA6Ly9zOXkub3JnPiB0byBmaW5kIG91dCBob3cu
The above was a test sent by the contact form. I had a friend try it on his mac, but he was able to read the email. Also note that this server is running php 5.3.0.

Something else that is interesting about this, the first part above (the stuff you can read, not the garbled characters) looks like what I would see in MS Outlook if I viewed an email's "options". For instance, on an email that worked OK from a different server, the options look like this:

Code: Select all

From: "don tester" <don.chambers@example.com>
Reply-To: "don tester" <don.chambers@example.net>
X-Mailer: Serendipity/1.3.1
X-Engine: PHP/4.3.11
Message-ID: <917a713f45e38704fc78ec16df724b2e@www.exxample.com>
MIME-Version: 1.0
Precedence: bulk
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
X-Nonspam: None
Obviously, the serendipity and php versions are different. For the garbled email, the outlook "options" are this:

Code: Select all

X-PHP-Originating-Script: 33:functions.inc.php
X-Nonspam: None
So... s9y? php?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Default mail encoding?

Post by garvinhicking »

Hi!

Those characters are base64 encoded, so it should look like this actually... how are they displayed in your outlook? Can you check with another mail client?

base64 encodes plaintext like binary data, that's why it looks encrypted.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

Emails that look fine are also base64 and do not include all the header info in the message text. We were able to get the text somewhat readable by activating the imap_8bit function, which was not previously activated. But emails from all of these sites running s9y 1.5B2 and php 5.3.0 still contain all the header info in the email body whereas all other sites, including one running s9y 1.5B2 with php 4.3.11.

I just sent you a contact form message from 2 different sites.
=Don=
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Default mail encoding?

Post by Timbalu »

Hi Don

Did you try it with
mail($to, $subject, $message, $headers, "-femail.address@example.com");
in the functions.inc.php?

Some people had problems with the headers before using the -f option

Ian
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

Timbalu wrote:Hi Don

Did you try it with
mail($to, $subject, $message, $headers, "-femail.address@example.com");
in the functions.inc.php?

Some people had problems with the headers before using the -f option

Ian
No Ian - I did not try that, primarily because I do not know exactly what to change.
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

I had the site send Garvin email, and he said everything looked fine to him. Here are my observations.

Windows XP, MS Office 2003
PHP 5.3.0 is encoding in quoted-printable. My other php versions are encoding in base64.
My quoted-printable emails have these characteristics different from base64:
* header data appears in message body.
* Virtually no header data appears in quoted-printable.
* Header's "From" field is user@servername on one site, but is the form's user submitted name on another site.
* email's "From" field (envelope??) is blank.
* Header's Reply-to is the form's user submitted name. Replying to the message addresses the email to blank.
* Header's sent date appears correct, but the email's date (envelope?) is "None" if I attempt a reply.

I have found very little info regarding quoted-printable encoding and outlook, and most of what I have found relates to plain text message SENDING, not receiving.

Does anyone else have 5.3.0, or whatever version is sufficient to have the imap_8bit function? If you do, can you do something to trigger an email to me by your s9y installation at don{~dot~}chambers{~at~}optional-necessity.com. I have been doing this via a contact form, so you could add my email address to your contact form, send the contact/comment, then change the email address back to your own.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Default mail encoding?

Post by garvinhicking »

Hi!

Can you check which MTA the different PHP 5.3 and 4.x sites uses? Sendmail, qmail, postfix, etc.?

Are both servers Linux?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

The server that is exhibiting the unusual behavior is linux and the MTA is postfix. The other server will be a bad comparison because it is godaddy. I have physical access to one other server, so let me get that one upgraded to s9y 1.5B2 and see how it behaves...
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Default mail encoding?

Post by garvinhicking »

Hi!

The server that doesnt work is a godaddy, I assume?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

garvinhicking wrote:The server that doesnt work is a godaddy, I assume?
Exact opposite - the godadddy server is fine, but it is running a much older version of php, and does not appear to have the imap_8bit function and is therefore encoding in base64.
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

It is looking highly probable that postfix is the problem. Switching the MTA to sendmail seems to resolve the problem (all but one, but that's probably a configuration item).

Neither sendmail nor postfix touches the encoding... any idea why postfix would be triggering a problem? I would prefer to use postfix on this server as it is supposed to be a lot faster and more secure.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Default mail encoding?

Post by garvinhicking »

Hi!

Often MTAs like postfix can be configured to revert/alter the newline (\r / \n / \r\n) behaviour of a mail, and thus tempering with the actual mail data, especially if it's 8bit-encoded. Sadly postfix and sendmail configs are something I don'T really grasp, so I don't really know which setting can be interfering here exactly :(

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

I cannot find any reference on postfix.org to altering newlines. :?

Emails sent from the site come from http@localhost.localdomain. Is serendipity providing this because it is unable to use a valid "from" address supplied in the form, or is this a mail setting?
=Don=
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Re: Default mail encoding?

Post by sonichouse »

Don Chambers wrote:I cannot find any reference on postfix.org to altering newlines. :?
Not sure if this is relevant, but check the eol settings described at postfix.org
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Default mail encoding?

Post by Don Chambers »

My other issue was fixed, but I will definitely check out that postfix EOL stuff. Thanks!
=Don=
Post Reply