Back

mailjet with appwrite

  • 0
  • Self Hosted
  • Auth
SeveTo
6 Aug, 2024, 23:13

I can't sent auth email I don't know what's happend

TypeScript
"use client";
import { account, databases } from "@/lib/appwrite";
import { useState } from "react";
import { ID } from "appwrite";

export const useRegisterUser = () => {
  const [loading, setLoading] = useState(false);
  const [error, setError] = useState(null);

  const registerUser = async (data) => {
    setLoading(true);
    setError(null);

    try {
      // create user appwrite
      const user = await account.create(ID.unique(), data.email, data.password);

      // Send verification email
      await account.createVerification("http://localhost:3000/verify-email");

      setLoading(false);
      return { success: true, user };
    } catch (error) {
      setLoading(false);
      setError(error.message);
      return { success: false, error };
    }
  };

  return { loading, error, registerUser };
};

why i can't send createVerification ?? i configure my SMTP in appwrite

TL;DR
Developers are facing an issue with sending verification emails using Appwrite with Mailjet. One suggestion is to check and configure the SMTP settings within the Appwrite environment file (.env). The provided code seems correct, but the error might be due to the "role: guest" status and the need to create a session first. This could potentially resolve the problem of not being able to send verification emails.
SeveTo
6 Aug, 2024, 23:15

my messages with the same config is working

Steven
6 Aug, 2024, 23:15

"role: guest" means you're not logged in. You need to create a session first

SeveTo
6 Aug, 2024, 23:16

ok i will try

SeveTo
6 Aug, 2024, 23:20
SeveTo
6 Aug, 2024, 23:20

i saw to .env but there is no SMTP option

Steven
6 Aug, 2024, 23:25

You must configure something in your .env

SeveTo
6 Aug, 2024, 23:27
SeveTo
6 Aug, 2024, 23:27

i did

SeveTo
6 Aug, 2024, 23:27

but still nothing

SeveTo
6 Aug, 2024, 23:28

i was trying figurout it by couple of hours

SeveTo
6 Aug, 2024, 23:39

i think is something serious because i found this https://github.com/appwrite/appwrite/discussions/4932

SeveTo
6 Aug, 2024, 23:39

i have same issue

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