I tried to contact dataset contacts and received the emails as expected. I just wanted to raise that there was no context info given: which dataset/dataverse, who wrote (I was logged in) etc. Thought that might be helpful for potential recipients.


Great suggestion @suenjedt we should do what we do for notifications where we include links to the dataset and dataverses they are referencing.
who wrote (I was logged in)
This part is mentioned in #3545.
At @pdurbin 's request; if this includes username (for authenticated users), than #3545 is a duplicate of this one.
Here's the "before" picture... I went to https://doi.org/10.7910/DVN/TJCLKP (a dataset of mine) and filled in the form like this:

Here's the email I got as the contact for the dataset:

I agree that some more context would be appreciated! I did this test on version 4.8.6.
In 8652ffa I started making the "Contact" button code testable and added context to the message based on if you are on a dataverse, dataset or file. Next steps:
I just made pull request #4571 and moved this issue to code review at https://waffle.io/IQSS/dataverse
As I mentioned to @djbrooke I'm making some somewhat arbitrary decisions about what context to include in the email. I figured the main thing is to provide a URL to the dataverse, dataset, or file, which I did at the top. Here are some examples:








Feedback from anyone is welcome!
This is a marked improvement over the old email format! I have a few thoughts on potential other improvements we could make:
_Message from Dataverse User: "[user-entered subject line]"_
The following message was sent from the contact button of [_dataset or file name, in italics_] at [url of dataset or file]
Message: [body of message]
Support Request: [user-entered subject line]
One slightly less extensive suggestion would be to move the "context" part of the message after the user-generated part. Aka -
Have you looked to see if this is too green in light of the recent paper?
Best,
Bob the Post-Doc
You're receiving this message from the contact button of The Spruce Dataset ($url)
@pdurbin Thanks, Phil. Is it possible to get the dataset DOI to show up in the contact dialogue box? Dataverse name is fine, if that is the contact point, but for datasets it would make send to just use the DOI
Closed duplicate issue Email Dataset Contact - Email needs more information when authors replyto a user #2882. In that issue @sbarbosadataverse commented on on Jan 21, 2016.
I've been using the email icon to contact authors and when they reply I get no indication which dataset/dataverse they are replying from. Would be more helpful to have this info attached to the email dialogue box in some way.

@mheppler one of the challenges with Hello {dataset.contact.FirstName + LastName}, is that Contact Name is freeform. Also, we suggest the form "LastName, FirstName" (i.e. "Brady, Tom") like this:

Just a quick update that I'm working away on the code and I think YAML-style separators (---) look better. Like this:
Hello Tom Brady,
You have just been sent the following message from [email protected] via the LibraScholar hosted dataset titled "Darwin's Finches" (doi:10.7910/DVN/TJCLKP):
---Let's talk!
---LibraScholar SWAT Team
[email protected]Go to dataset https://dataverse.librascholar.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/TJCLKP
You received this email because you have been listed as a contact for the dataset. If you believe this was an error, please contact LibraScholar SWAT Team at [email protected]. To respond directly to the individual who sent the message, simply reply to this email.
I also made a couple other small tweaks. Note that the contact form doesn't let you say your name so above you just see the email address but I guess I'll be adding that.
Finally, at standup this morning we decided that #4580 is out of scope for now but it's highly related and sounds like a real issue based on my reading of https://help.hmdc.harvard.edu/Ticket/Display.html?id=260778
9c56a0f has some of the progress I've made. Note that at the dataverse level, we do not persist the contact name. We only persist the email address. Here's a screenshot:

So, I'll try to come up a reasonable alternative to "Hello Tom Brady," for the greeting.
Since we don't have a contact name for Dataverses and dataset contact is (potentially) in "Last Name, First Name" format, can we just from that from the greeting? "Hello," should be just as effective and should get this moved along.
Any objections?
@mheppler @scolapasta @dlmurphy and anyone else who's interested in what text appears in the "bundle", I think I'm mostly done messing with the text as of 6c22b9e if you'd like to take a look at the "diff" in Bundle.properties at https://github.com/IQSS/dataverse/pull/4571/files
Please note that since I've been focused on providing more context for dataverses, datasets, and files, I haven't thought much about adding more context to the generic "Support" emails but if someone wants to suggest something I can probably work it in without too much trouble since it's the same code.
I'm staying on this issue to do some testing to make sure I didn't break anything with all my refactoring to make the code testable.
Ok, also, @qqmyers popped in IRC this morning and he's going to take a look at related issue #4580. I explained that we're working on the content first but then we'll want to address how in some cases these emails aren't being delivered, which is what that other issue is about.
Thanks, @pdurbin. Bundle text looks good in the PR diff!
For the support emails, I think we can go a little more generic. I've cut down the template to something a little more streamline since we don't need to pass any dataverse, dataset, file info.
{Harvard Dataverse Support}<br>
<br>
The following message from {usr.contact.email}...<br>
<br>
----<br>
<br>
{usr.contact.message}<br>
<br>
----<br>
<br>
To respond directly to the individual who sent the message, simply reply to this email.
The bundle text looks good to me, thanks! Also, Mike's change to the support emails looks good to me too.
Bah. The content is better but the code itself is buggy and needs work. I'm pounding on it.
Ok, as of 197c57d I think the pull request is in pretty good shape for code review.
We could keep doing more on this branch, including:
I'll keep myself on this issue for now but developers are welcome to give me feedback on the code.
In 038d5a3 I went ahead and added more context to the support emails, with minor tweaks approved by @mheppler
@mheppler and I are on the same page that at this time I am not going to pursue adding a field for "full name" or whatever we call it. The main reason for this is that I'd have to touch a lot of files and this isn't a high priority. Here's a screnshot of the files we'd need to modify:

In addition to the files above the change would need to be made in contactFormFragment.xhtml. The benefits of making this change in the future are two-fold. First, "From" in the current form is somewhat ambiguous in that it could mean "email address" or "name". Here's a screenshot:

If or when we add "full name" we should decide how to label it. Perhaps we could write "Your Name" and "Your Email" like this:

The second benefit of having the second field is that we'll be able populate {usr.contact.FirstName + LastName} in the desired design above, which says "You have just been sent the following message from {usr.contact.FirstName + LastName}". Right now the code just always puts the email address there instead.
Since I think I'm done hacking on the code (barring any bugs I introduced), I'm taking myself off this issue and I'm ready for code review.
Reviewed, moved into QA.
Tested new context email works as described with the exception of
Support email says, "To respond directly to the individual who sent the message, simply reply to this email." but this does not currently work this way according to @pdurbin
@kcondon sorry, I believe we have a misunderstanding. It does work that way, or it should. Support emails are sent from the email address provided in the support form. That's the "from" address. So replying to that from address should reach the individual who provided an email address in the support form.
Of course, if you're logged in, when you fill the the support form, you shouldn't be asked for an email address. The email on file for your account will be used.
I hope this all makes sense!
Updated support email template text to remove inaccurate reply instructions.
contact.context.support.ending=\n\n---\n\nMessage sent from Support contact form.
The issue for Contact Us Email: Set the reply to address to be from the user, from address from dataverse. Otherwise email blocked. #4580 should address existing issues with the reply address. I will add a comment on that issue as well. There will need to be consideration for how our RT system works when we change the from and reply fields in the support emails.
Most helpful comment
Just a quick update that I'm working away on the code and I think YAML-style separators (
---) look better. Like this:I also made a couple other small tweaks. Note that the contact form doesn't let you say your name so above you just see the email address but I guess I'll be adding that.
Finally, at standup this morning we decided that #4580 is out of scope for now but it's highly related and sounds like a real issue based on my reading of https://help.hmdc.harvard.edu/Ticket/Display.html?id=260778