By Mohamed Ragheb on Friday, 05 April 2019
Posted in Technical Issues
Likes 0
Views 643
Votes 0
Hello,
We have a request from a number of subscribers to the forum. They would like to add a prefix [IUG] to the front of every email Subject that is sent from the site. This way they can be filtered and organised correctly in their mail software as some are reciving a lot of emails mixed with their other email.

Which file would I need to modify to add a prefix? perhaps this can also be a feature request for future releases?

Thanks
Hi Mohamed Ragheb,

Unfortunately it is not possible to alter email's subject at this point of time.
But your can customize in the file:
.../administrator/components/com_easydiscuss/includes/mailer/mailer.php

perhaps this can also be a feature request for future releases?

This quite a nice feature to have, perhaps can you create a new ticket under feature request so that our developer can keep track the feature request that can be implement in the future
·
Friday, 05 April 2019 18:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello, Thanks for the reply, I will certainly add it as a feature request.

I've taken a look at the mailer.php file you mention and found the subject is setup between lines 406 and 436:


$mailq = ED::table('MailQueue');
$mailq->recipient = $emailTo;
$mailq->subject = $data['emailSubject'];
$mailq->body = self::_prepareBody($data);
$mailq->created = ED::date()->toSql();
$mailq->ashtml = ED::config()->get('notify_html_format');

$mailq->mailfrom = self::getMailFrom($data);
$mailq->fromname = self::getFromName($data);
$mailq->status = 0;

return $mailq->store();
}

// Insert to MailQueue Table
public function addQueue($emailTo, $subject, $content, $mailfrom = '', $fromname = '')
{
if (!$emailTo) {
return;
}

$mailq = ED::table('MailQueue');
$mailq->recipient = $emailTo;
$mailq->subject = $subject;
$mailq->body = $content;
$mailq->created = ED::date()->toSql();
$mailq->ashtml = ED::config()->get('notify_html_format');

$mailq->mailfrom = ($mailfrom) ? $mailform : self::getMailFrom();
$mailq->fromname = ($fromname) ? $fromname : self::getFromName();
$mailq->status = 0;


Forgive me my PHP is not as good as yours but would simply modifying the above entry to

$mailq->subject = '[IUG] '.$data['emailSubject'];

and

$mailq->subject = '[IUG] '.$subject;

Be the correct code to add IUG to the start of email subjects?
·
Friday, 05 April 2019 20:53
·
0 Likes
·
0 Votes
·
0 Comments
·
If all you want to do is to prepend the [IUG] text, then that should be it.
·
Friday, 05 April 2019 22:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Mark,
Thanks yes it now working and adding the prefix to emails. Thanks for the help, hopefully this can become a standard feature of future releases.
·
Monday, 08 April 2019 22:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating Mohamed and you are most welcome. Glad that your issue is resolved now
·
Monday, 08 April 2019 23:33
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post