Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add brevo adapter and test suite for the same. #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AkhileshJyotishi
Copy link

What does this PR do?

This PR implements brevo email adapter.

Test Plan

To execute the Brevo E2E test suite, you will need a Brevo account with certain requirements. Please follow these steps:

  1. Create a Brevo Account:

    • Create a new account on Brevo.
  2. Set Up Sender Information:

    • Follow the steps outlined by Brevo for setting up sender information.
  3. Prepare Email Addresses:

    • Ensure you have two valid email addresses available, one for sending and one for receiving emails. These email addresses should be associated with the domain you've set up in your Sender Signature.
  4. Obtain Brevo API Key:

    • Grab your API key from Brevo. You can usually find it in your account settings or by visiting the API tokens section.
  5. Install Required PHP Extensions: (For unix-based distributions)

    • Ensure that your PHP environment is properly configured by installing the necessary extensions. Run the following commands to install the required PHP extensions:
      sudo apt-get install php-mbstring
      sudo apt-get install php-curl
      sudo apt install php-xml
      sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
  6. Install PHPUnit and Dependencies:

    • Open a terminal and navigate to the root directory of your 'utopia-php/messaging' project.
    • Run the following command to install PHPUnit and related packages using Composer:
      composer install
  7. Run E2E Tests:

    • With the required setup complete, you can now execute the E2E tests, providing the necessary environment variables. Replace YOUR_BREVO_API_KEY, YOUR_TEST_EMAIL, and YOUR_TEST_FROM_EMAIL with your actual Brevo API key, test email address, and from email address, respectively. Ensure that YOUR_TEST_EMAIL and YOUR_TEST_FROM_EMAIL belong to the same domain as your Sender Signature:
      BREVO_API_KEY=YOUR_BREVO_API_KEY TEST_EMAIL=YOUR_TEST_EMAIL TEST_FROM_EMAIL=YOUR_TEST_FROM_EMAIL ./vendor/bin/phpunit tests/e2e/Email/BrevoTest.php

Video Demonstration

To get a visual walkthrough of running the Brevo E2E test, watch the video provided below:

Loom.Free.Screen.Video.Recording.Software.Loom.-.2.October.2023.1.mp4

Related PRs and Issues

closes: appwrite/appwrite#6384

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

Yes

Copy link
Contributor

@loks0n loks0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need ENV vars also?

Does Brevo have regions, or multiple domains?

*/
public function testSendPlainTextEmail()
{
// $this->markTestSkipped('Brevo credentials not set.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this?

Comment on lines +34 to +36



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove these empty lines?


public function getMaxMessagesPerRequest(): int
{
return 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link the documentation to support this in the PR description or as a response to this comment?

$message->getTo()
),
"subject" => $message->getSubject(),
$bodyKey => $message->getContent(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do the same as in Mailgun.php

    'text' => $message->isHtml() ? null : $message->getContent(),
    'html' => $message->isHtml() ? $message->getContent() : null,

@tessamero
Copy link

@AkhileshJyotishi

Thank you for your contribution to Hacktoberfest 2023! We've noticed that your PR is still pending and requires some updates based on our engineering team's feedback.

We would love to see your PR successfully merged and send you the Appwrite swag as a token of appreciation. To remain eligible for the swag, please address the pending suggestions and/or ensure the tests pass by Friday, November 17th. If the PR isn't updated by then, we will unfortunately have to close it due to the end of the Hacktoberfest event.

Looking forward to your updates and thank you!

@gewenyu99
Copy link

Hey there! There were a lot of big PRs during this Hacktoberfest, and we wanted to give everyone ample time to collaborate with our engineering team. If you were able to merge your PRs during October, amazing. If it’s still not merged, don’t worry about it either. Either way, we’ve got your Hacktoberfest swag minted and ready to ship.

Please comment with your Discord username here so we can contact you about your shipping information to deliver your Hacktoberfest swag.

@AkhileshJyotishi
Copy link
Author

@gewenyu99

my username akhilesh_32621

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💬 Improve Appwrite Messaging with Brevo Adapter
4 participants