-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixMicrosoftEmailPlugin.inc.php
More file actions
49 lines (43 loc) · 989 Bytes
/
FixMicrosoftEmailPlugin.inc.php
File metadata and controls
49 lines (43 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
import('lib.pkp.classes.plugins.GenericPlugin');
class FixMicrosoftEmailPlugin extends GenericPlugin
{
/**
* @copydoc Plugin::getDisplayName()
*/
function getDisplayName()
{
return 'Fix Microsoft Email Plugin';
}
/**
* @copydoc Plugin::getDescription()
*/
function getDescription()
{
return 'This plugin is a workaround to fix Microsoft Email client.';
}
/**
* @copydoc Plugin::register()
*/
function register($category, $path, $mainContextId = null)
{
$success = parent::register($category, $path, $mainContextId);
if ($success && $this->getEnabled($mainContextId)) {
HookRegistry::register('Mail::send', [$this, 'onMailSend']);
}
return $success;
}
/**
* Hook to Mail::send
* @param $hookName string
* @param $params array
*/
function onMailSend($hookName, $args)
{
$mail = $args[0]; // Mail
$from = $mail->getFrom();
if($from !== null){
$mail->setFrom(Config::getVar('email', 'smtp_username'), $from['name']);
}
}
}