diff --git a/Dockerfile b/Dockerfile index 19d90e3a..abb97006 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# Stage 1: Composer FROM composer:2.0 as composer ARG TESTING=false @@ -15,6 +16,7 @@ RUN composer install \ --no-scripts \ --prefer-dist +# Stage 2: PHP FROM php:8.0-cli-alpine WORKDIR /usr/local/src/ @@ -22,4 +24,6 @@ WORKDIR /usr/local/src/ COPY --from=composer /usr/local/src/vendor /usr/local/src/vendor COPY . /usr/local/src/ -CMD [ "tail", "-f", "/dev/null" ] \ No newline at end of file + + +CMD [ "tail", "-f", "/dev/null" ] diff --git a/composer.lock b/composer.lock index 9f6b978b..eea229ad 100644 --- a/composer.lock +++ b/composer.lock @@ -4,35 +4,35 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5ecbd865cbd7f14e7819fb79643573be", + "content-hash": "9a5b54bf8cc5b2265f1ce16d43d58af9", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -59,7 +59,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -75,20 +75,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "laravel/pint", - "version": "v1.2.0", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86" + "reference": "e0a8cef58b74662f27355be9cdea0e726bbac362" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/1d276e4c803397a26cc337df908f55c2a4e90d86", - "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86", + "url": "https://api.github.com/repos/laravel/pint/zipball/e0a8cef58b74662f27355be9cdea0e726bbac362", + "reference": "e0a8cef58b74662f27355be9cdea0e726bbac362", "shasum": "" }, "require": { @@ -99,13 +99,13 @@ "php": "^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.11.0", - "illuminate/view": "^9.27", - "laravel-zero/framework": "^9.1.3", - "mockery/mockery": "^1.5.0", - "nunomaduro/larastan": "^2.2", - "nunomaduro/termwind": "^1.14.0", - "pestphp/pest": "^1.22.1" + "friendsofphp/php-cs-fixer": "^3.14.4", + "illuminate/view": "^9.51.0", + "laravel-zero/framework": "^9.2.0", + "mockery/mockery": "^1.5.1", + "nunomaduro/larastan": "^2.4.0", + "nunomaduro/termwind": "^1.15.1", + "pestphp/pest": "^1.22.4" }, "bin": [ "builds/pint" @@ -141,20 +141,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2022-09-13T15:07:15+00:00" + "time": "2023-02-14T16:31:02+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -192,7 +192,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -200,20 +200,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.1", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -254,9 +254,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2022-09-04T07:30:47+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "phar-io/manifest", @@ -371,16 +371,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.8.0", + "version": "v6.8.1", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1" + "reference": "e88da8d679acc3824ff231fdc553565b802ac016" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/df16b615e371d81fb79e506277faea67a1be18f1", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e88da8d679acc3824ff231fdc553565b802ac016", + "reference": "e88da8d679acc3824ff231fdc553565b802ac016", "shasum": "" }, "require": { @@ -390,13 +390,13 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.1", + "squizlabs/php_codesniffer": "^3.7.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { @@ -439,7 +439,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.0" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.1" }, "funding": [ { @@ -447,27 +447,27 @@ "type": "github" } ], - "time": "2023-03-06T14:43:22+00:00" + "time": "2023-08-29T08:26:30+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.17", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -482,8 +482,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -516,7 +516,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, "funding": [ { @@ -524,7 +525,7 @@ "type": "github" } ], - "time": "2022-08-30T12:24:04+00:00" + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", @@ -769,16 +770,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.10", + "version": "9.6.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328" + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6d351645c3fe5a30f5e86be6577d946af65a328", - "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "shasum": "" }, "require": { @@ -793,7 +794,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -852,7 +853,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" }, "funding": [ { @@ -868,7 +869,7 @@ "type": "tidelift" } ], - "time": "2023-07-10T04:04:23+00:00" + "time": "2023-09-19T05:39:22+00:00" }, { "name": "sebastian/cli-parser", @@ -1170,16 +1171,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -1224,7 +1225,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -1232,20 +1233,20 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -1287,7 +1288,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -1295,7 +1296,7 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -1376,16 +1377,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { @@ -1428,7 +1429,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" }, "funding": [ { @@ -1436,7 +1437,7 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-08-02T09:26:13+00:00" }, { "name": "sebastian/lines-of-code", @@ -1609,16 +1610,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -1657,10 +1658,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -1668,7 +1669,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -1727,16 +1728,16 @@ }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -1771,7 +1772,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -1779,7 +1780,7 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -1898,5 +1899,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/docker-compose.yml b/docker-compose.yml index 80d626d9..fe62835f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,12 @@ version: '3.9' services: tests: + environment: + - SMTP2GO_USERNAME + - SMTP2GO_PASSWORD + - SMTP2GO_SERVER + - SMTP2GO_PORT - MAILGUN_API_KEY - MAILGUN_DOMAIN - SENDGRID_API_KEY @@ -29,6 +34,7 @@ services: - VONAGE_API_SECRET - VONAGE_TO - VONAGE_FROM + build: context: . volumes: @@ -44,4 +50,4 @@ services: request-catcher: image: appwrite/requestcatcher:1.0.0 ports: - - '10001:5000' \ No newline at end of file + - '10001:5000' diff --git a/src/Utopia/Messaging/Adapter.php b/src/Utopia/Messaging/Adapter.php index 60a909ef..df122c9b 100644 --- a/src/Utopia/Messaging/Adapter.php +++ b/src/Utopia/Messaging/Adapter.php @@ -6,29 +6,21 @@ abstract class Adapter { /** * Get the name of the adapter. - * - * @return string */ abstract public function getName(): string; /** * Get the type of the adapter. - * - * @return string */ abstract public function getType(): string; /** * Get the type of the message the adapter can send. - * - * @return string */ abstract public function getMessageType(): string; /** * Get the maximum number of messages that can be sent in a single request. - * - * @return int */ abstract public function getMaxMessagesPerRequest(): int; diff --git a/src/Utopia/Messaging/Adapters/Email/Mailgun.php b/src/Utopia/Messaging/Adapters/Email/Mailgun.php index 4e3882e8..09ad8895 100644 --- a/src/Utopia/Messaging/Adapters/Email/Mailgun.php +++ b/src/Utopia/Messaging/Adapters/Email/Mailgun.php @@ -20,8 +20,6 @@ public function __construct( /** * Get adapter name. - * - * @return string */ public function getName(): string { @@ -30,8 +28,6 @@ public function getName(): string /** * Get adapter description. - * - * @return int */ public function getMaxMessagesPerRequest(): int { diff --git a/src/Utopia/Messaging/Adapters/Email/Sendgrid.php b/src/Utopia/Messaging/Adapters/Email/Sendgrid.php index e91c31cc..18dccc20 100644 --- a/src/Utopia/Messaging/Adapters/Email/Sendgrid.php +++ b/src/Utopia/Messaging/Adapters/Email/Sendgrid.php @@ -17,8 +17,6 @@ public function __construct(private string $apiKey) /** * Get adapter name. - * - * @return string */ public function getName(): string { @@ -27,8 +25,6 @@ public function getName(): string /** * Get max messages per request. - * - * @return int */ public function getMaxMessagesPerRequest(): int { @@ -38,8 +34,6 @@ public function getMaxMessagesPerRequest(): int /** * {@inheritdoc} * - * @param Email $message - * @return string * * @throws Exception */ diff --git a/src/Utopia/Messaging/Adapters/Email/Smtp2go.php b/src/Utopia/Messaging/Adapters/Email/Smtp2go.php new file mode 100644 index 00000000..415784b5 --- /dev/null +++ b/src/Utopia/Messaging/Adapters/Email/Smtp2go.php @@ -0,0 +1,53 @@ +isSMTP(); + $mailer->Username = $smtpUsername; + $mailer->Password = $smtpPassword; + $mailer->Host = $smtpServer; + $mailer->Port = $smtpPort; + $mailer->SMTPAuth = true; + + // Set email content + $mailer->setFrom('Senders-email', 'Name'); + $mailer->addAddress('Receivers-email', 'Name'); + $mailer->Subject = 'Test Subject'; + $mailer->Body = 'Test mail'; + + // Send the email + if ($mailer->send()) { + return 'Email sent successfully'; + } else { + return 'Failed to send email: '.$mailer->ErrorInfo; + } + } +} diff --git a/src/Utopia/Messaging/Adapters/Push/APNS.php b/src/Utopia/Messaging/Adapters/Push/APNS.php index 56282d83..559fb6d7 100644 --- a/src/Utopia/Messaging/Adapters/Push/APNS.php +++ b/src/Utopia/Messaging/Adapters/Push/APNS.php @@ -9,11 +9,6 @@ class APNS extends PushAdapter { /** - * @param string $authKey - * @param string $authKeyId - * @param string $teamId - * @param string $bundleId - * @param string $endpoint * @return void */ public function __construct( @@ -27,8 +22,6 @@ public function __construct( /** * Get adapter name. - * - * @return string */ public function getName(): string { @@ -37,8 +30,6 @@ public function getName(): string /** * Get max messages per request. - * - * @return int */ public function getMaxMessagesPerRequest(): int { @@ -48,8 +39,6 @@ public function getMaxMessagesPerRequest(): int /** * {@inheritdoc} * - * @param Push $message - * @return string * * @throws Exception */ @@ -179,7 +168,6 @@ function ($value) { /** * Generate JWT. * - * @return string * * @throws Exception */ diff --git a/src/Utopia/Messaging/Adapters/Push/FCM.php b/src/Utopia/Messaging/Adapters/Push/FCM.php index 8a4d8ac2..4a028f62 100644 --- a/src/Utopia/Messaging/Adapters/Push/FCM.php +++ b/src/Utopia/Messaging/Adapters/Push/FCM.php @@ -17,8 +17,6 @@ public function __construct( /** * Get adapter name. - * - * @return string */ public function getName(): string { @@ -27,8 +25,6 @@ public function getName(): string /** * Get max messages per request. - * - * @return int */ public function getMaxMessagesPerRequest(): int { diff --git a/src/Utopia/Messaging/Messages/Email.php b/src/Utopia/Messaging/Messages/Email.php index 21fedeea..545b1d54 100644 --- a/src/Utopia/Messaging/Messages/Email.php +++ b/src/Utopia/Messaging/Messages/Email.php @@ -24,49 +24,31 @@ public function __construct( ) { } - /** - * @return array - */ public function getTo(): array { return $this->to; } - /** - * @return string - */ public function getSubject(): string { return $this->subject; } - /** - * @return string - */ public function getContent(): string { return $this->content; } - /** - * @return string|null - */ public function getFrom(): ?string { return $this->from; } - /** - * @return array|null - */ public function getAttachments(): ?array { return $this->attachments; } - /** - * @return bool - */ public function isHtml(): bool { return $this->html; diff --git a/src/Utopia/Messaging/Messages/Push.php b/src/Utopia/Messaging/Messages/Push.php index 93b8f5d7..337d0fbd 100644 --- a/src/Utopia/Messaging/Messages/Push.php +++ b/src/Utopia/Messaging/Messages/Push.php @@ -32,9 +32,6 @@ public function __construct( ) { } - /** - * @return array - */ public function getTo(): array { return $this->to; @@ -45,73 +42,46 @@ public function getFrom(): ?string return null; } - /** - * @return string - */ public function getTitle(): string { return $this->title; } - /** - * @return string - */ public function getBody(): string { return $this->body; } - /** - * @return array|null - */ public function getData(): ?array { return $this->data; } - /** - * @return string|null - */ public function getAction(): ?string { return $this->action; } - /** - * @return string|null - */ public function getSound(): ?string { return $this->sound; } - /** - * @return string|null - */ public function getIcon(): ?string { return $this->icon; } - /** - * @return string|null - */ public function getColor(): ?string { return $this->color; } - /** - * @return string|null - */ public function getTag(): ?string { return $this->tag; } - /** - * @return string|null - */ public function getBadge(): ?string { return $this->badge; diff --git a/src/Utopia/Messaging/Messages/SMS.php b/src/Utopia/Messaging/Messages/SMS.php index bcb913c0..31be8d99 100644 --- a/src/Utopia/Messaging/Messages/SMS.php +++ b/src/Utopia/Messaging/Messages/SMS.php @@ -14,33 +14,21 @@ public function __construct( ) { } - /** - * @return array - */ public function getTo(): array { return $this->to; } - /** - * @return string - */ public function getContent(): string { return $this->content; } - /** - * @return string|null - */ public function getFrom(): ?string { return $this->from; } - /** - * @return array|null - */ public function getAttachments(): ?array { return $this->attachments; diff --git a/tests/e2e/Email/Smtp2goTest.php b/tests/e2e/Email/Smtp2goTest.php new file mode 100644 index 00000000..0919c429 --- /dev/null +++ b/tests/e2e/Email/Smtp2goTest.php @@ -0,0 +1,47 @@ +assertNotEmpty($smtp2goUsername, 'SMTP2GO_USERNAME is not set'); + $this->assertNotEmpty($smtp2goPassword, 'SMTP2GO_PASSWORD is not set'); + $this->assertNotEmpty($smtp2goServer, 'SMTP2GO_SERVER is not set'); + $this->assertNotEmpty($smtp2goPort, 'SMTP2GO_PORT is not set'); + + // Instantiate the SMTP2GO adapter + $sender = new Smtp2go($smtp2goServer, $smtp2goPort, $smtp2goUsername, $smtp2goPassword); + + // Email details + $to = 'Receivers-email'; + $subject = 'Test Subject'; + $content = 'Test Content'; + $from = 'Senders-email'; + + // Create an email message + $message = new Email( + to: [$to], + subject: $subject, + content: $content, + from: $from + ); + + // Send the email using SMTP2GO + $result = $sender->send($message); + + // Check if the email was sent successfully + $this->assertEquals('Email sent successfully', $result); + } +}