Back

[SOLVED] [Error] Message: Appwrite\Event\Mail::setRecipient()

  • 0
  • Self Hosted
  • Accounts
  • Web
khashashin
1 Jul, 2023, 23:37

Can't send verification email. On the client side registration process after calling this.account.create() I tried to send Email verification by using this.account.createVerification('http://localhost:4200/verify'); but this fails. In the docker-compose logs -f --tail=50 appwrite I see following error:

TL;DR
The user is unable to send a verification email after creating a new account using the Appwrite API. They have tried calling `this.account.createVerification('http://localhost:4200/verify');` but it throws an error. The error message suggests that the recipient (email) is null. The user has posted their code and the error log from the server. Another user suggests that creating the email session before calling `this.account.createVerification('http://localhost:4200/verify');` resolved the issue. However, it is mentioned that anonymous sessions do not work currently.
khashashin
1 Jul, 2023, 23:37
TypeScript
khashashin@dockers-khasdev:~/appwrite$ docker-compose logs -f --tail=50 appwrite
Attaching to appwrite
appwrite                        | Worker 1 started successfully
appwrite                        | Worker 2 started successfully
appwrite                        | Worker 3 started successfully
appwrite                        | Worker 4 started successfully
appwrite                        | [Setup] - Server database init started...
appwrite                        | [Setup] - Creating database: appwrite...
appwrite                        | [Setup] - Server database init completed...
appwrite                        | Server started successfully (max payload is 6,291,456 bytes)
appwrite                        | Master pid 1, manager pid 8
appwrite                        | [Error] Timestamp: 2023-07-01T23:27:55+00:00
appwrite                        | [Error] Type: Utopia\Exception
appwrite                        | [Error] Message: Not Found
appwrite                        | [Error] File: /usr/src/code/vendor/utopia-php/framework/src/App.php
appwrite                        | [Error] Line: 803
appwrite                        | [Error] Timestamp: 2023-07-01T23:28:18+00:00
appwrite                        | [Error] Method: POST
appwrite                        | [Error] URL: /v1/account/verification
appwrite                        | [Error] Type: TypeError
appwrite                        | [Error] Message: Appwrite\Event\Mail::setRecipient(): Argument #1 ($recipient) must be of type string, null given, called in /usr/src/code/app/controllers/api/account.php on line 2301
appwrite                        | [Error] File: /usr/src/code/src/Appwrite/Event/Mail.php
appwrite                        | [Error] Line: 50

The user creation was successfull an I can verify in Appwrite console the user exists. The response I got from Appwrite instance was:

TypeScript
{"message":"Server Error","code":500,"type":"general_unknown","version":"1.3.7"}
khashashin
1 Jul, 2023, 23:38

Here is the code in client side:

TypeScript
    register(user: UserCreate) {
        const promise = this.account.create(
            ID.unique(),
            user.email,
            user.password,
            user.firstName + ' ' + user.lastName,
        );
        promise.then((response) => {
            this.account.createVerification('http://localhost:4200/verify');
        }, function (error) {
            console.log(error); // Failure
        });
    }
Drake
2 Jul, 2023, 01:29

Weird...this is saying the email is null...maybe you have a previous anonymous session

Drake
2 Jul, 2023, 01:30

This code is also missing the session creation

khashashin
2 Jul, 2023, 01:58

@Steven You mean, I should call this.account.createVerification('http://localhost:4200/verify'); after creating session? Could it be anonymous session?

Drake
2 Jul, 2023, 01:58

No it doesn't work with anonymous session at the moment. See https://github.com/appwrite/appwrite/issues/5220

khashashin
2 Jul, 2023, 02:15

Ok, thanks. By creating email session before calling this.account.createVerification('http://localhost:4200/verify'); works!

Drake
2 Jul, 2023, 02:31

[SOLVED] [Error] Message: Appwrite\Event\Mail::setRecipient()

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more