Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ignitetch
GitHub Repository: ignitetch/advphishing
Path: blob/master/PHPMailer/test/fakefunctions.php
738 views
1
<?php
2
3
if (!function_exists('idn_to_ascii')) {
4
function idn_to_ascii()
5
{
6
return true;
7
}
8
}
9
10
if (!function_exists('mb_convert_encoding')) {
11
function mb_convert_encoding()
12
{
13
return true;
14
}
15
}
16
17
if (!function_exists('imap_rfc822_parse_adrlist')) {
18
function imap_rfc822_parse_adrlist($addressList)
19
{
20
$addresses = explode(',', $addressList);
21
$fakedAddresses = [];
22
foreach ($addresses as $address) {
23
$fakedAddresses[] = new FakeAddress($address);
24
}
25
26
return $fakedAddresses;
27
}
28
29
if (!class_exists(FakeAddress::class)) {
30
class FakeAddress
31
{
32
public $host = 'example.com';
33
public $mailbox = 'joe';
34
public $personal = 'joe example';
35
36
/**
37
* FakeAddress constructor.
38
*
39
* @param string $addressString
40
*/
41
public function __construct($addressString)
42
{
43
$addressParts = explode('@', $addressString);
44
$this->mailbox = trim($addressParts[0]);
45
$this->host = trim($addressParts[1]);
46
$this->personal = explode('.', $addressParts[1])[0];
47
}
48
}
49
}
50
}
51
52