Possible bug or misunderstanding about topic invitations


(Travis Lindsey) #1

I have the following scenario:

  1. Another admin (Jon Doe, userb2) started a topic.
  2. I (also a admin+maintainer …Travis Lindsey, usera1) invited some people to that topic from within the thread.
  3. Users are seeing the invite in their email as from “Jon Doe” in the from field even though the first line of the email body says: " usera1 invited you to a discussion".

Looks like:

From: Elastic Email [mailto:mailer@elasticemail.com] On Behalf Of Jon Doe
Sent: Monday, June 25, 2018 8:15 AM
To: user@example.com
Subject: [Testing ForumD1] usera1 invited you to ‘Poll for Adopting this Platform’

usera1 invited you to a discussion

I discovered this because a user contacted me and asked why it says in the from name “Jon Doe” but in the body it says “usera1 invited you to a discussion”. It’s confusing. Jon Doe doesn’t know about these invitations but people are getting emails that suggest the message was on his behalf.

Is this a bug or is this the intended behavior (to send messages with from name=Topic Creator, if topic creator has name filled out in profile preferences)?

If this is intended behavior, is there a way I can change it so the from name is always equal to the site name and not topic creator?

I did a ./launcher rebuild app and tried to reproduce the issue.

At this point, I really think its a site bug. If topic creator has their “name” filled out in profile preferences, the email “from” name is the topic creators name, regardless of who sent the invite. If the topic creator does not have their “name” filled out in their profile preferences, the email “from” name is the site name.

I did the following to reproduce:

Email From Name = Site Name

  1. Create another Admin (Username=“useradmin4”)
  2. Left “name” field under profile where it has “your full name (optional)” BLANK
  3. Login as useradmin4
  4. Created a topic
  5. Logout
  6. Login in as my user (Travis Lindsey, usera1)
  7. Send an Invite to that topic, to a random user, from within that topic.

The email from name shows up for them as coming from the site name “Testing ForumD1”:

From: Elastic Email [mailto:mailer@elasticemail.com] On Behalf Of Testing ForumD1

Email From Name = Topic Creators Name

  1. Logout of my account
  2. Login to useradmin4
  3. Fill out/update the “Name” field in useradmin4 profile preferences with “Another User”
  4. Create another topic
  5. Logout
  6. Login to my account (Travis Lindsey, usera1)
  7. Send an Invite to that topic, to a random user, from within that topic.

The email from name shows up for them as coming from the topic owner “Another User”:

From: Elastic Email [mailto:mailer@elasticemail.com] On Behalf Of Another User

Note that the words “On Behalf Of” are irrelevant and probably being generated based on the email client because of a unverified domain. I’m OK with “On Behalf Of”. The issue is the “Name” tied to who the email is from is changing from the Site name to the topic owners name if the topic owner has completed their Name field in their profile. It doesn’t matter who sends the invite from the thread. The from name is the topic owner name if the topic owner has filled out their name, or it’s the site name if the topic owner has not. I only tested/confirmed this is the case when the topic owner is a site admin.

I’m not talking about email subject.

Here is another view from a different users email to look at if the view is confusing:

Email posted as from Topic Owner: Happens if topic creator is admin and has profile name filled out.

Another User noreply@discourse.tst.com via elasticemail.com

Email posted as from Site: Happens if topic creator does not have profile name filled out.

Testing ForumD1 noreply@discourse.tst.com via elasticemail.com

Can anyone show me how to fix this within the app settings or source code?


Change Send As in Email Notifications
(Bhanu Sharma) #2

I smell like something funny happening from Elasticemail’s side!
is your domain properly verified in their system?

I’m using mailgun I’ll try to invite some users and share what I get.


(Travis Lindsey) #3

That may be the case, looking forward to your post. I’'ve been going through the source code trying to see how invitations are handled from threads to search for clues.

is your domain properly verified in their system?

It is not. We are testing and using with a free gmail account. The way we got around the domain requirement while testing on our LAN was by setting the domain name in our DNS Resolver to point to the IP address of the server. That shouldn’t affect the “On Behalf Of” name. Messages are being sent and delivered without issues. Just problems with the “On Behalf Of” or “From” name from topic invitations being topic owner instead of topic inviter.


(Bhanu Sharma) #4

This is definitely something being done by elasticemail!

Screenshot%20from%202018-06-25%2021-07-56

My mails come as follows!


(Travis Lindsey) #5

Thanks for the post. That’s strange, you dont even have a “On Behalf Of”. I’m reaching out to the ElasticEmail while looking for other clues.


(Bhanu Sharma) #6

You should definitely contact their support, we have @Marcin_Pus on this forum who works for elasticemail so maybe he can help you in some way?


(Travis Lindsey) #7

Hopefully because i’m lost. I did a ./launcher rebuild app and tried to reproduce the issue.

At this point, I really think its a site bug. If topic creator has their “name” filled out in profile preferences, the email “from” name is the topic creators name, regardless of who sent the invite. If the topic creator does not have their “name” filled out in their profile preferences, the email “from” name is the site name.

I did the following to reproduce:

Email From Name = Site Name

  1. Create another Admin (Username=“useradmin4”)
  2. Left “name” field under profile where it has “your full name (optional)” BLANK
  3. Login as useradmin4
  4. Created a topic
  5. Logout
  6. Login in as my user (Travis Lindsey, usera1)
  7. Send an Invite to that topic, to a random user, from within that topic.

The email from name shows up for them as coming from the site name “Testing ForumD1”:

From: Elastic Email [mailto:mailer@elasticemail.com] On Behalf Of Testing ForumD1

Email From Name = Topic Creators Name

  1. Logout of my account
  2. Login to useradmin4
  3. Fill out/update the “Name” field in useradmin4 profile preferences with “Another User”
  4. Create another topic
  5. Logout
  6. Login to my account (Travis Lindsey, usera1)
  7. Send an Invite to that topic, to a random user, from within that topic.

The email from name shows up for them as coming from the topic owner “Another User”:

From: Elastic Email [mailto:mailer@elasticemail.com] On Behalf Of Another User

Note that the words “On Behalf Of” is irrelevant and probably being generated based on the email client because of a unverified domain. I’m OK with “On Behalf Of”. The issue is the “Name” tied to who the email is from is changing from the Site name to the topic owners name if the topic owner has completed their Name field in their profile. It doesn’t matter who sends the invite from the thread. The from name is the topic owner name if the topic owner has filled out their name, or it’s the site name if the topic owner has not. I only tested/confirmed this is the case when the topic owner is a site admin.

Can anyone show me how to fix this within the app settings or source code? Or should I move this to bug tag?


(Bhanu Sharma) #8

This can’t be fixed in discourse because titles are not being modified by discourse directly. I’d highly recommend setting up a different email provider with a valid, verified domain because sending from unverified domain is neither recommended nor is considered a good practice.


(Travis Lindsey) #9

Are you talking about this part “On Behalf Of” or this part “Testing ForumD1”


(Travis Lindsey) #10

Are you talking about this part “On Behalf Of” or this part “Testing ForumD1”


(Bhanu Sharma) #11

I’m talking of the whole title because our titles don’t match at all.

Discourse should send name (username) in case a name is specified or username otherwise.

Your email title is botchered up somewhere else.


(Travis Lindsey) #12

The title “On Behalf Of” doesn’t match because of unverified domain…this is OK and expected.

The issue I’m having can be reproduced from within Discourse app (steps above). The issue is the From Name will be Topic Owner if the conditions in the steps I listed above are true. ElasticMail does not control/change the from name.

They are getting that information from the Discourse app (Topic Creator=“Another User” or Site Name= “Testing ForumD1”)


(Bhanu Sharma) #13

%name% %username% invited you to %topic title%

Vs

Elasticemail on behalf of %name%

That is the problem.

Now, one workaround is to set email title manually there is some setting for that! I’ll post it’s name in a bit.

Edit: it’s called email_subject

But that probably won’t help in case of invites


(Travis Lindsey) #14

I’m having a hard time explaining this. I’ve moved this to bug in hopes that someone else can read my post and chime in. You’re looking at email subject. I’m not talking about email subject.

Here is another view from a different users email to look at if the view is confusing:

Email posted as from Topic Owner: Happens if topic creator is admin and has profile name filled out.

Another User noreply@discourse.tst.com via elasticemail.com

Email posted as from Site: Happens if topic creator does not have profile name filled out.

Testing ForumD1 noreply@discourse.tst.com via elasticemail.com


(Bhanu Sharma) #15

However, default email template has subject set like this:

Which again validates my point, problem should be sorted at elasticemail rather than discourse.

I’d still say, this is a not a bug in discourse.


(Travis Lindsey) #16

@itsbhanusharma, I changed line 380 in source code /app/mailers/user_notifications.rb
to reflect “Forum Name” and now the “from” name when inviting a user to a topic always reflects the site name and not the topic creator. The new results are as follows:

Email posted as from Topic Owner : Happens if topic creator is admin and has profile name filled out. This first one use to show up as “Another User” but now it shows up in users emails like.

Testing ForumD1 noreply@discourse.tst.com via elasticemail.com

Email posted as from Site : Happens if topic creator does not have profile name filled out.

Testing ForumD1 noreply@discourse.tst.com via elasticemail.com

or depending on the users mail client, it looks like this:

From: Elastic Email [mailto:mailer@elasticemail.com] On Behalf Of Testing ForumD1

After changing source code on discourse, they all have the correct from name regardless of if the users profile “name” is blank or not. If this was an elasticemail issue, changing discourse source code would not affect the from name for email.


(Bhanu Sharma) #17

If You’d have looked carefully, editing the Subject value of the user invited to topic value would have returned similar results. You could have just removed %(username) and hard coded whatever you wanted to display :wink:

Plus, regardless of if name is present or not, I can’t reproduce that behavior on my side so I can’t support that it’s a bug. All the best maintaining the file if that works for you :slight_smile:


(Marcin Puś) #18

Thank you for calling me out.

Please write to us at support.elasticemail.com and send the affected messages ID. We can investigate it and also check on the account if it is configured properly.

It is hard to give sensible feedback before we have a closer look. Just too many options :).