PHP Email Changed Behavior

Bug #1219008 reported by KosherJava
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
webtrees
Fix Released
Low
fisharebest

Bug Description

As mentioned https://bugs.launchpad.net/webtrees/+bug/1218027 and http://www.webtrees.net/index.php/en/forum/3-help-for-beta-and-svn-versions/28201-changes-to-php-mail the recent email changes caused some issues
1. the subject changed from "[webtrees Message]" to "webtrees Message - ". I prefer the former (and I had filters for this)
2. The "from" email address used to be <email address hidden> via my.domain.com" (the way gmail shows it) and now shows as the default email address for my PHP hosting so the email appears to come from my own non-preferred email address.
3. Related to #2, replying to the message email results in an email to myself.

Revision history for this message
fisharebest (fisharebest) wrote :

1) this is deliberate. Hard-coded latin punctuation is inappropriate on non-latin scripts such as arabic. It also causes LTR/RTL problems. The name of the family tree may be more appropriate. I am open to suggestions.

2a) is <email address hidden> the sender, the recipeient, one of the configuration settings?
2b) is this a user-user message or a broadcast message such as "there are pending changes"

3) replying to what message. Lots are sent, including multiple copies of the same one.

Changed in webtrees:
status: New → Incomplete
Revision history for this message
KosherJava (kosherjava) wrote :

1). I am OK with the current one. Adding the tree name will make the subject too long
2a) yes this is the sender's email address
2b) this is when the user send an email via the contact link
3) When I click reply to respond to the sender, since the person who sent the message is not part of the email headers, the email will by default go back to me unless I paste in the sender's email address.

Revision history for this message
fisharebest (fisharebest) wrote :

Bear in mind that I've never used the messaging feature, and have no intuitive feeling of what is wrong/right behaviour. I simply tried to create new code that did the same as the old code.

Are you sending messages as a visitor (where you type in your name/email) to the site admin

- or -

are you sending messages from one user to another?

Tell me the exact steps you take. It would also help to include the actual email headers.

Revision history for this message
KosherJava (kosherjava) wrote :

When a visitor visits the page and click on the contact link on the footer, it pops up a contact form that emails me. It is this email that I am talking about.

Revision history for this message
KosherJava (kosherjava) wrote :

My contact method is internal messaging with email.

Revision history for this message
fisharebest (fisharebest) wrote :

I've tried using the contact form to send myself a message.

Here are the mail headers

Sender: Greg Roach <email address hidden>
From: <email address hidden>
To: Greg Roach <email address hidden>

The "Sender:" field is the GMAIL account used to send the mail.

The "From:" field is set to "no-reply@localhost", however if you use an address that is not linked to your account, GMAIL rewrites the mail header with your "primary" address. If I use PHP/sendmail, then this field is set to "no-reply@localhost" as expected.

The "To:" is the webtrees account.

All these seem correct to me.

Revision history for this message
wdm001 (wdm001) wrote :

This also happening to me. Greg in the above post you can see the from is also the to. I assume when you posted the message you put your gmail address in the from. it is the entered address that we want to show in the email as from.

As Kosher mentioned if the from is populated with the entered email then you can reply to them directly.

This was the behaviour that we used to see that was so much more convienent

Revision history for this message
fisharebest (fisharebest) wrote :

<<it is the entered address that we want to show in the email as from.>>

But if GMAIL decides to rewrite the headers to change the "from" field from whatever you entered to your actual account address, what can we do?

Revision history for this message
KosherJava (kosherjava) wrote :

The issue is that with 1.4 there was no re-writing. I have other PHP apps that use PHP mail and the headers are not rewritten by Gmail.

Revision history for this message
E. Castedo Ellerman (castedo) wrote :

I have added
https://bugs.launchpad.net/webtrees/+bug/1240602
to document in what way the old behaviour in 1.4 was broken and why the new behaviour in1.5 is, at least partially, desirable.

Regarding the sub-issue of #3 in the bug description of this #1219008 above:
"replying to the message email results in an email to myself."

I can recommend the fix of ADDING a "Reply-To:" email header field instead of setting the "From:" to any arbitrary email address that is untrusted and unverified to certain SMTP servers (like AWS SES).

Revision history for this message
E. Castedo Ellerman (castedo) wrote :

In terms of the actual nitty gritty code of
https://github.com/fisharebest/webtrees/blob/fe536f924de8a8c2a60e69d0d9724255a47696c9/includes/authentication.php
I can recommend an easy fix inside function addMessage($message) that retains the 1.5 branch fix for #1240602 and PARTIALLY fixes at least one of the issues mentioned in this email, specifically:

A) keep the assignment of $WEBTREES_EMAIL to the $from_email parameters of WT_Mail::send().
  $WEBTREES_EMAIL should be a trusted verified email address to the SMTP server and the $from_email parameter will set the "From:" SMTP header field.

B) add a $reply_to parameter to WT_Mail::send function and assign to that the "from" values used in branch 1.4.
     Then inside WT_Mail::send the $reply_to parameter can be passed to the setReplyTo function of Zend_Mail.

Since I use AWS SES I just want From: to remain $WEBTREES_EMAIL as it coded in the current trunk. webtrees admins should set that to a responsible value that all SMTP servers are happy with. IMHO, it is the "Reply-To:" header, not the "From:" header that should be set to whatever is the arbitrary email address a new users says is their preferred email address.

IMHO, if a user has a problem with From: being something like <email address hidden> and is not happy enough with Reply-To: being set to their address, then they should just send email from their normal email client rather than send a message via webtrees.

Revision history for this message
fisharebest (fisharebest) wrote :

I've submitted a fix for this. However, I'm behind a firewall and cannot test SMTP.

Changed in webtrees:
status: Incomplete → In Progress
importance: Undecided → Low
assignee: nobody → fisharebest (fisharebest)
Revision history for this message
fisharebest (fisharebest) wrote :

This appears to be working.

Changed in webtrees:
status: In Progress → Fix Committed
Revision history for this message
KosherJava (kosherjava) wrote :

The "reply to" does seem to be working but I would suggest the following tweak (f possible).

Current:
From: <email address hidden>
Reply-To: some user <email address hidden>

Proposed:
From: Family Tree Title Contact <email address hidden>
Reply-To: some user <email address hidden>

Or
From: some user <email address hidden>
Reply-To: some user <email address hidden>

Revision history for this message
fisharebest (fisharebest) wrote :

Fix released in webtrees 1.5.0

Changed in webtrees:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.