• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Change FROM email on Conversation Alerts?

craigiri

Well-known member
#1
As the admin, I end up getting lots of messages when user hit reply after getting an email notification of a conversation they are engaged in.

Is there anyway to change the "from" of this message to a nulled email like "donotreply@mydomain.com" without changing that of other system emails?
 

craigiri

Well-known member
#3
Hmm...am I missing something? That seems to set it globally....that is for all thread notifications as well as conversation notifications. I want to just have it different in the conversation notifications.
 

MagnusB

Well-known member
#4
Sorry, might have misunderstood, but that option only controls the global email, AFAIK there is no way to change for just one part.
 

Jake Bunce

XenForo moderator
Staff member
#5
As the admin, I end up getting lots of messages when user hit reply after getting an email notification of a conversation they are engaged in.
I hate that.

Is there anyway to change the "from" of this message to a nulled email like "donotreply@mydomain.com" without changing that of other system emails?
Edit this file:

library/XenForo/Model/Conversation.php

Add the red code:

Code:
	public function insertConversationAlert(array $conversation, array $alertUser, $action,
		array $triggerUser = null, array $extraData = null, array &$messageInfo = null
	)
	{
		if (!$triggerUser)
		{
			$triggerUser = array(
				'user_id' => $conversation['last_message_user_id'],
				'username' => $conversation['last_message_username']
			);
		}

		if ($triggerUser['user_id'] == $alertUser['user_id'])
		{
			return;
		}

		if ($alertUser['email_on_conversation'] && $alertUser['user_state'] == 'valid')
		{
			if (!isset($conversation['titleCensored']))
			{
				$conversation['titleCensored'] = XenForo_Helper_String::censorString($conversation['title']);
			}

			if (isset($messageInfo['message']) && XenForo_Application::get('options')->emailConversationIncludeMessage)
			{
				if (!isset($messageInfo['messageText']))
				{
					$bbCodeParserText = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Text'));
					$messageInfo['messageText'] = new XenForo_BbCode_TextWrapper($messageInfo['message'], $bbCodeParserText);

					$bbCodeParserHtml = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('HtmlEmail'));
					$messageInfo['messageHtml'] = new XenForo_BbCode_TextWrapper($messageInfo['message'], $bbCodeParserHtml);
				}

				$emailTemplate = "conversation_{$action}_messagetext";
			}
			else
			{
				$emailTemplate = "conversation_{$action}";
			}

			$mail = XenForo_Mail::create($emailTemplate, array(
				'receiver' => $alertUser,
				'sender' => $triggerUser,
				'options' => XenForo_Application::get('options'),
				'conversation' => $conversation,
				'message' => $messageInfo,
			), $alertUser['language_id']);

			$mail->enableAllLanguagePreCache();
			$mail->queue($alertUser['email'], $alertUser['username'], array(), 'from@mail.com', 'from name');
		}
	}
That should do it.

This can be made into an addon instead of a file edit if you wish.
 

craigiri

Well-known member
#6
Wow, thanks Jake....
As to it being an add-on. I guess that would survive updates easier but not that important to me. If others can use this, maybe you or someone can make it so.....
 

Ludachris

Well-known member
#7
Sorry to bring this back from the dead, but another cool plugin idea would be to make it so if the user hits the reply button in the email, it automatically adds a reply to the Conversation. That might be quite a bit more involved for a plugin. I know Facebook does it this way, and with as much as forums rely on email alerts I think this would be a very elegant way to handle this common problem. I'll go ahead and request the add-on and suggest it for core.

In the meantime I'll probably edit the file as Jake suggested, assuming the same instructions still work in 1.3?