Skip to content
Back

[SOLVED] Could not connect to SMTP host.

  • 0
  • Self Hosted
  • Functions
BugProg
19 Oct, 2023, 17:12

Hi there !

I'm trying to send an email with Appwrite function and PHP Mailer.

On my server I executed this file (Not in Appwrite function):

TypeScript
use PHPMailer\PHPMailer\PHPMailer;
require_once 'vendor/autoload.php';

  $mail = new PHPMailer();  // Create new PHPMailer

    $mail->isHTML(true);
    $mail->Encoding = 'base64';
    $mail->CharSet = 'UTF-8';
    $mail->IsSMTP(); // enable SMTP
    $mail->SMTPDebug = 1;  // debug: 1 = errors and message, 2 = message only
    $mail->SMTPAuth = true;  // Enable SMTP authenticate
    $mail->Username = "test@email.fr"; // SMTP username
    $mail->Password = "password";
    $mail->SMTPSecure = 'PHPMailer::ENCRYPTION_STARTTLS';
    $mail->Host = "pro2.mail.ovh.net";
    $mail->Port = 587;
    $mail->SetFrom("test@email", "test@email");
    $mail->Subject = 'Test Email';
    $mail->Body = "Hi !";
    $mail->AddAddress("tested@email.fr");
   $mail->Send();

and everything work fine.

But when I tried the same code on Appwrite (self-hosted), I got Could not connect to SMTP host. Do you have an idea why ?

TL;DR
Title: [SOLVED] Issue with connecting to SMTP host in Appwrite Message: The user is encountering an error message "Could not connect to SMTP host" when trying to send an email using Appwrite and PHP Mailer. The user has already tested the code on their server and it worked fine. They are seeking help to resolve this issue. Solution: As a first step, the user is advised to check if they can ping Google or the SMTP host `pro2.mail.ovh.net` as a sanity check.
toseven
19 Oct, 2023, 17:22

I have also met the same situation

BugProg
19 Oct, 2023, 17:26

Did you find something to solve this issue ?

toseven
19 Oct, 2023, 17:32

not yet, this issue has blocked me for a while

Tessa
19 Oct, 2023, 17:34

@VincentGe can you take a look at this?

VincentGe
19 Oct, 2023, 17:43

@BugProg As a sanity check, see if you can do something like pinging Google or this host pro2.mail.ovh.net

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