HTML emails and subject not being recognized by email clients I did this

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
User avatar
darakhshan
Registered User
Posts: 1032
Joined: Fri Apr 30, 2004 7:18 pm

HTML emails and subject not being recognized by email clients I did this

Post by darakhshan »

Sorry I think I am sending this in right category because I need to know if the change might effect other things?

Guys I changed these lines in /includes/functions_messenger.php

Code: Select all

$this->msg = str_replace("\r\n", "\n", $this->msg);

		// We now try and pull a subject from the email body ... if it exists,
		// do this here because the subject may contain a variable
		$drop_header = '';
		$match = array();
		if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match))
		{
			$this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']);
			$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
		}
		else
		{
			$this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']);
		}

to these lines

Code: Select all

// Replace Windows line endings with Unix line endings
$this->msg = str_replace("\r\n", "\n", $this->msg);

// Extract the subject from the email body, if it exists
$drop_header = '';
$match = array();
if (preg_match('#<title>(.*?)</title>#i', $this->msg, $match)) {
  $this->subject = (trim($match[1]) != '') ? trim($match[1]) : (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']);
  $drop_header .= '[\r\n]*?' . preg_quote($match[0], '#');
} else {
  $this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']);
}

// Remove the subject from the email body
$this->msg = preg_replace('#'.$drop_header.'#', '', $this->msg);
I had a problem with the subject not getting recognized by the email client. Now everything works fine
Will there be any side effects?
When you stop learning, stop listening, stop looking and asking questions, always new questions, then it is time to die. Lillian Smith :!:
Post Reply

Return to “phpBB Custom Coding”