Skip to content

Commit e5cfe9f

Browse files
feat: "used php mailer to send emails in page-contact.php & send html page table to anyone in companies.php"
1 parent 9683dd2 commit e5cfe9f

File tree

77 files changed

+10761
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+10761
-57
lines changed

Companies.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
margin-left: 844px;
9090
margin-top: 26px;
9191
}
92+
93+
.mail {}
9294
</style>
9395

9496
<!-- Template Main CSS File -->
@@ -249,6 +251,9 @@
249251
<!-- ---------------------------------------------------End Sidebar--------------------------------------------------->
250252

251253
<button id="fixedButton" type="button" onclick="window.location.href = 'create.php';" class="btn btn-primary mb-3 add">Add Company</button>
254+
<button id="fixedButton" type="button" onclick="window.location.href = 'emailTable.php';" class="btn btn-outline-info mail">
255+
<b><i class="ri-mail-line"></i></b>
256+
</button>
252257
<div class="container">
253258

254259
</div>

PHPMailer/.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

PHPMailer/COMMITMENT

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
GPL Cooperation Commitment
2+
Version 1.0
3+
4+
Before filing or continuing to prosecute any legal proceeding or claim
5+
(other than a Defensive Action) arising from termination of a Covered
6+
License, we commit to extend to the person or entity ('you') accused
7+
of violating the Covered License the following provisions regarding
8+
cure and reinstatement, taken from GPL version 3. As used here, the
9+
term 'this License' refers to the specific Covered License being
10+
enforced.
11+
12+
However, if you cease all violation of this License, then your
13+
license from a particular copyright holder is reinstated (a)
14+
provisionally, unless and until the copyright holder explicitly
15+
and finally terminates your license, and (b) permanently, if the
16+
copyright holder fails to notify you of the violation by some
17+
reasonable means prior to 60 days after the cessation.
18+
19+
Moreover, your license from a particular copyright holder is
20+
reinstated permanently if the copyright holder notifies you of the
21+
violation by some reasonable means, this is the first time you
22+
have received notice of violation of this License (for any work)
23+
from that copyright holder, and you cure the violation prior to 30
24+
days after your receipt of the notice.
25+
26+
We intend this Commitment to be irrevocable, and binding and
27+
enforceable against us and assignees of or successors to our
28+
copyrights.
29+
30+
Definitions
31+
32+
'Covered License' means the GNU General Public License, version 2
33+
(GPLv2), the GNU Lesser General Public License, version 2.1
34+
(LGPLv2.1), or the GNU Library General Public License, version 2
35+
(LGPLv2), all as published by the Free Software Foundation.
36+
37+
'Defensive Action' means a legal proceeding or claim that We bring
38+
against you in response to a prior proceeding or claim initiated by
39+
you or your affiliate.
40+
41+
'We' means each contributor to this repository as of the date of
42+
inclusion of this file, including subsidiaries of a corporate
43+
contributor.
44+
45+
This work is available under a Creative Commons Attribution-ShareAlike
46+
4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/).

PHPMailer/LICENSE

Lines changed: 502 additions & 0 deletions
Large diffs are not rendered by default.

PHPMailer/README.md

Lines changed: 231 additions & 0 deletions
Large diffs are not rendered by default.

PHPMailer/SECURITY.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Security notices relating to PHPMailer
2+
3+
Please disclose any security issues or vulnerabilities found through [Tidelift's coordinated disclosure system](https://tidelift.com/security) or to the maintainers privately.
4+
5+
PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the `$patternselect` parameter to `validateAddress()` is set to `'php'` (the default, defined by `PHPMailer::$validator`), and the global namespace contains a function called `php`, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names. Recorded as [CVE-2021-3603](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3603). Reported by [Vikrant Singh Chauhan](mailto:vi@hackberry.xyz) via [huntr.dev](https://www.huntr.dev/).
6+
7+
PHPMailer versions 6.4.1 and earlier contain a possible remote code execution vulnerability through the `$lang_path` parameter of the `setLanguage()` method. If the `$lang_path` parameter is passed unfiltered from user input, it can be set to [a UNC path](https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths), and if an attacker is also able to persuade the server to load a file from that UNC path, a script file under their control may be executed. This vulnerability only applies to systems that resolve UNC paths, typically only Microsoft Windows.
8+
PHPMailer 6.5.0 mitigates this by no longer treating translation files as PHP code, but by parsing their text content directly. This approach avoids the possibility of executing unknown code while retaining backward compatibility. This isn't ideal, so the current translation format is deprecated and will be replaced in the next major release. Recorded as [CVE-2021-34551](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-34551). Reported by [Jilin Diting Information Technology Co., Ltd](https://listensec.com) via Tidelift.
9+
10+
PHPMailer versions between 6.1.8 and 6.4.0 contain a regression of the earlier CVE-2018-19296 object injection vulnerability as a result of [a fix for Windows UNC paths in 6.1.8](https://github.com/PHPMailer/PHPMailer/commit/e2e07a355ee8ff36aba21d0242c5950c56e4c6f9). Recorded as [CVE-2020-36326](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-36326). Reported by Fariskhi Vidyan via Tidelift. 6.4.1 fixes this issue, and also enforces stricter checks for URL schemes in local path contexts.
11+
12+
PHPMailer versions 6.1.5 and earlier contain an output escaping bug that occurs in `Content-Type` and `Content-Disposition` when filenames passed into `addAttachment` and other methods that accept attachment names contain double quote characters, in contravention of RFC822 3.4.1. No specific vulnerability has been found relating to this, but it could allow file attachments to bypass attachment filters that are based on matching filename extensions. Recorded as [CVE-2020-13625](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-13625). Reported by Elar Lang of Clarified Security.
13+
14+
PHPMailer versions prior to 6.0.6 and 5.2.27 are vulnerable to an object injection attack by passing `phar://` paths into `addAttachment()` and other functions that may receive unfiltered local paths, possibly leading to RCE. Recorded as [CVE-2018-19296](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-19296). See [this article](https://knasmueller.net/5-answers-about-php-phar-exploitation) for more info on this type of vulnerability. Mitigated by blocking the use of paths containing URL-protocol style prefixes such as `phar://`. Reported by Sehun Oh of cyberone.kr.
15+
16+
PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it is not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project.
17+
18+
PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity.
19+
20+
PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer).
21+
22+
PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html).
23+
24+
PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8476) an SMTP CRLF injection bug permitting arbitrary message sending.
25+
26+
PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file.
27+
28+
PHPMailer versions prior to 2.0.7 and 2.2.1 are vulnerable to [CVE-2012-0796](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-0796), an email header injection attack.
29+
30+
Joomla 1.6.0 uses PHPMailer in an unsafe way, allowing it to reveal local file paths, reported in [CVE-2011-3747](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3747).
31+
32+
PHPMailer didn't sanitise the `$lang_path` parameter in `SetLanguage`. This wasn't a problem in itself, but some apps (PHPClassifieds, ATutor) also failed to sanitise user-provided parameters passed to it, permitting semi-arbitrary local file inclusion, reported in [CVE-2010-4914](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4914), [CVE-2007-2021](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2021) and [CVE-2006-5734](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-5734).
33+
34+
PHPMailer 1.7.2 and earlier contained a possible DDoS vulnerability reported in [CVE-2005-1807](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-1807).
35+
36+
PHPMailer 1.7 and earlier (June 2003) have a possible vulnerability in the `SendmailSend` method where shell commands may not be sanitised. Reported in [CVE-2007-3215](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-3215).
37+

PHPMailer/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.9.1

PHPMailer/composer.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"name": "phpmailer/phpmailer",
3+
"type": "library",
4+
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
5+
"authors": [
6+
{
7+
"name": "Marcus Bointon",
8+
"email": "phpmailer@synchromedia.co.uk"
9+
},
10+
{
11+
"name": "Jim Jagielski",
12+
"email": "jimjag@gmail.com"
13+
},
14+
{
15+
"name": "Andy Prevost",
16+
"email": "codeworxtech@users.sourceforge.net"
17+
},
18+
{
19+
"name": "Brent R. Matzelle"
20+
}
21+
],
22+
"funding": [
23+
{
24+
"url": "https://github.com/Synchro",
25+
"type": "github"
26+
}
27+
],
28+
"config": {
29+
"allow-plugins": {
30+
"dealerdirect/phpcodesniffer-composer-installer": true
31+
},
32+
"lock": false
33+
},
34+
"require": {
35+
"php": ">=5.5.0",
36+
"ext-ctype": "*",
37+
"ext-filter": "*",
38+
"ext-hash": "*"
39+
},
40+
"require-dev": {
41+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
42+
"doctrine/annotations": "^1.2.6 || ^1.13.3",
43+
"php-parallel-lint/php-console-highlighter": "^1.0.0",
44+
"php-parallel-lint/php-parallel-lint": "^1.3.2",
45+
"phpcompatibility/php-compatibility": "^9.3.5",
46+
"roave/security-advisories": "dev-latest",
47+
"squizlabs/php_codesniffer": "^3.7.2",
48+
"yoast/phpunit-polyfills": "^1.0.4"
49+
},
50+
"suggest": {
51+
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
52+
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
53+
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
54+
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
55+
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
56+
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
57+
"psr/log": "For optional PSR-3 debug logging",
58+
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication",
59+
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
60+
},
61+
"autoload": {
62+
"psr-4": {
63+
"PHPMailer\\PHPMailer\\": "src/"
64+
}
65+
},
66+
"autoload-dev": {
67+
"psr-4": {
68+
"PHPMailer\\Test\\": "test/"
69+
}
70+
},
71+
"license": "LGPL-2.1-only",
72+
"scripts": {
73+
"check": "./vendor/bin/phpcs",
74+
"test": "./vendor/bin/phpunit --no-coverage",
75+
"coverage": "./vendor/bin/phpunit",
76+
"lint": [
77+
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build"
78+
]
79+
}
80+
}

PHPMailer/get_oauth_token.php

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
<?php
2+
3+
/**
4+
* PHPMailer - PHP email creation and transport class.
5+
* PHP Version 5.5
6+
* @package PHPMailer
7+
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
8+
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
9+
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
10+
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
11+
* @author Brent R. Matzelle (original founder)
12+
* @copyright 2012 - 2020 Marcus Bointon
13+
* @copyright 2010 - 2012 Jim Jagielski
14+
* @copyright 2004 - 2009 Andy Prevost
15+
* @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License
16+
* @note This program is distributed in the hope that it will be useful - WITHOUT
17+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18+
* FITNESS FOR A PARTICULAR PURPOSE.
19+
*/
20+
21+
/**
22+
* Get an OAuth2 token from an OAuth2 provider.
23+
* * Install this script on your server so that it's accessible
24+
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
25+
* e.g.: http://localhost/phpmailer/get_oauth_token.php
26+
* * Ensure dependencies are installed with 'composer install'
27+
* * Set up an app in your Google/Yahoo/Microsoft account
28+
* * Set the script address as the app's redirect URL
29+
* If no refresh token is obtained when running this file,
30+
* revoke access to your app and run the script again.
31+
*/
32+
33+
namespace PHPMailer\PHPMailer;
34+
35+
/**
36+
* Aliases for League Provider Classes
37+
* Make sure you have added these to your composer.json and run `composer install`
38+
* Plenty to choose from here:
39+
* @see https://oauth2-client.thephpleague.com/providers/thirdparty/
40+
*/
41+
//@see https://github.com/thephpleague/oauth2-google
42+
use League\OAuth2\Client\Provider\Google;
43+
//@see https://packagist.org/packages/hayageek/oauth2-yahoo
44+
use Hayageek\OAuth2\Client\Provider\Yahoo;
45+
//@see https://github.com/stevenmaguire/oauth2-microsoft
46+
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
47+
//@see https://github.com/greew/oauth2-azure-provider
48+
use Greew\OAuth2\Client\Provider\Azure;
49+
50+
if (!isset($_GET['code']) && !isset($_POST['provider'])) {
51+
?>
52+
<html>
53+
<body>
54+
<form method="post">
55+
<h1>Select Provider</h1>
56+
<input type="radio" name="provider" value="Google" id="providerGoogle">
57+
<label for="providerGoogle">Google</label><br>
58+
<input type="radio" name="provider" value="Yahoo" id="providerYahoo">
59+
<label for="providerYahoo">Yahoo</label><br>
60+
<input type="radio" name="provider" value="Microsoft" id="providerMicrosoft">
61+
<label for="providerMicrosoft">Microsoft</label><br>
62+
<input type="radio" name="provider" value="Azure" id="providerAzure">
63+
<label for="providerAzure">Azure</label><br>
64+
<h1>Enter id and secret</h1>
65+
<p>These details are obtained by setting up an app in your provider's developer console.
66+
</p>
67+
<p>ClientId: <input type="text" name="clientId"><p>
68+
<p>ClientSecret: <input type="text" name="clientSecret"></p>
69+
<p>TenantID (only relevant for Azure): <input type="text" name="tenantId"></p>
70+
<input type="submit" value="Continue">
71+
</form>
72+
</body>
73+
</html>
74+
<?php
75+
exit;
76+
}
77+
78+
require 'vendor/autoload.php';
79+
80+
session_start();
81+
82+
$providerName = '';
83+
$clientId = '';
84+
$clientSecret = '';
85+
$tenantId = '';
86+
87+
if (array_key_exists('provider', $_POST)) {
88+
$providerName = $_POST['provider'];
89+
$clientId = $_POST['clientId'];
90+
$clientSecret = $_POST['clientSecret'];
91+
$tenantId = $_POST['tenantId'];
92+
$_SESSION['provider'] = $providerName;
93+
$_SESSION['clientId'] = $clientId;
94+
$_SESSION['clientSecret'] = $clientSecret;
95+
$_SESSION['tenantId'] = $tenantId;
96+
} elseif (array_key_exists('provider', $_SESSION)) {
97+
$providerName = $_SESSION['provider'];
98+
$clientId = $_SESSION['clientId'];
99+
$clientSecret = $_SESSION['clientSecret'];
100+
$tenantId = $_SESSION['tenantId'];
101+
}
102+
103+
//If you don't want to use the built-in form, set your client id and secret here
104+
//$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
105+
//$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
106+
107+
//If this automatic URL doesn't work, set it yourself manually to the URL of this script
108+
$redirectUri = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
109+
//$redirectUri = 'http://localhost/PHPMailer/redirect';
110+
111+
$params = [
112+
'clientId' => $clientId,
113+
'clientSecret' => $clientSecret,
114+
'redirectUri' => $redirectUri,
115+
'accessType' => 'offline'
116+
];
117+
118+
$options = [];
119+
$provider = null;
120+
121+
switch ($providerName) {
122+
case 'Google':
123+
$provider = new Google($params);
124+
$options = [
125+
'scope' => [
126+
'https://mail.google.com/'
127+
]
128+
];
129+
break;
130+
case 'Yahoo':
131+
$provider = new Yahoo($params);
132+
break;
133+
case 'Microsoft':
134+
$provider = new Microsoft($params);
135+
$options = [
136+
'scope' => [
137+
'wl.imap',
138+
'wl.offline_access'
139+
]
140+
];
141+
break;
142+
case 'Azure':
143+
$params['tenantId'] = $tenantId;
144+
145+
$provider = new Azure($params);
146+
$options = [
147+
'scope' => [
148+
'https://outlook.office.com/SMTP.Send',
149+
'offline_access'
150+
]
151+
];
152+
break;
153+
}
154+
155+
if (null === $provider) {
156+
exit('Provider missing');
157+
}
158+
159+
if (!isset($_GET['code'])) {
160+
//If we don't have an authorization code then get one
161+
$authUrl = $provider->getAuthorizationUrl($options);
162+
$_SESSION['oauth2state'] = $provider->getState();
163+
header('Location: ' . $authUrl);
164+
exit;
165+
//Check given state against previously stored one to mitigate CSRF attack
166+
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
167+
unset($_SESSION['oauth2state']);
168+
unset($_SESSION['provider']);
169+
exit('Invalid state');
170+
} else {
171+
unset($_SESSION['provider']);
172+
//Try to get an access token (using the authorization code grant)
173+
$token = $provider->getAccessToken(
174+
'authorization_code',
175+
[
176+
'code' => $_GET['code']
177+
]
178+
);
179+
//Use this to interact with an API on the users behalf
180+
//Use this to get a new access token if the old one expires
181+
echo 'Refresh Token: ', htmlspecialchars($token->getRefreshToken());
182+
}

0 commit comments

Comments
 (0)