alextselegidis / easyappointments

:date: Easy!Appointments - Self Hosted Appointment Scheduler
https://easyappointments.org
GNU General Public License v3.0
3.28k stars 1.26k forks source link

The email with confirmations details is not sent #1419

Closed radar155 closed 11 months ago

radar155 commented 11 months ago

I'm using version 1.5.0-dev.4.

When an appointment is booked, the confirmation email is not sent.

ERROR - 2023-10-11 23:20:19 --> Notifications - Could not email confirmation details of appointment (10) : Call to undefined function Jsvrcek\ICS\mb_strcut()
ERROR - 2023-10-11 23:20:19 --> #0 /var/www/easy/vendor/jsvrcek/ics/src/CalendarExport.php(212): Jsvrcek\ICS\CalendarStream->addItem()
#1 /var/www/easy/application/libraries/Ics_file.php(184): Jsvrcek\ICS\CalendarExport->getStream()
#2 /var/www/easy/application/libraries/Notifications.php(85): Ics_file->get_stream()
#3 /var/www/easy/application/controllers/Booking.php(571): Notifications->notify_appointment_saved()
#4 /var/www/easy/system/core/CodeIgniter.php(481): Booking->register()
#5 /var/www/easy/index.php(360): require_once('...')
#6 {main}

Meanwhile, email sent for cancellation are working correctly (I'm using gmail smtp for testing purpose). This is the content of my email.php

<?php defined('BASEPATH') or exit('No direct script access allowed');

// Add custom values by settings them to the $config array.
// Example: $config['smtp_host'] = 'smtp.gmail.com';
// @link https://codeigniter.com/user_guide/libraries/email.html

$config['useragent'] = 'Easy!Appointments';
$config['protocol'] = 'smtp'; // or 'smtp'
$config['mailtype'] = 'html'; // or 'text'
$config['smtp_debug'] = '0'; // or '1'
#$config['smtp_auth'] = TRUE; //or FALSE for anonymous relay.
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_user'] = 'xxxx@gmail.com';
$config['smtp_pass'] = 'xxxxxx';
$config['smtp_crypto'] = 'tls'; // or 'tls'
$config['smtp_port'] = 587;
$config['newline'] = "\r\n";
radar155 commented 11 months ago

After a little investigation I found the problem is not related to email itself but with the php-mbstring module, that was missing from my system.

Running sudo apt-get install php-mbstring solved the issue.

This is also discussed in #448

geomax2024 commented 6 months ago

My installation also doesnt send confirmation emails... Initially i enabled debug mode and got the following error : An uncaught Exception was encountered Type: Error

Message: Call to undefined function Jsvrcek\ICS\mb_strcut()

Filename: /var/www/html/easyappointments/vendor/jsvrcek/ics/src/CalendarStream.php

Line Number: 66

I installed mbstring, also individually installed for both 7.4 and 8.3 {sudo apt install php7.4-mbstring} which fixed the exception error preventing the confirmation window from popping up at the end when an appointment is finalized (confirm button didnt do anything before although data appeared to log in back-office, but after installing mbstring it now shows the popup window). The data logs properly into the database but the confirmation email is still not sent. Any advice on how to check the settings (which file to check for smtp or the confirmation email send details) associated with that particular final step in the confirmation process would be greatly appreciated... (is /var/www/html/easyappointments/vendor/jsvrcek/ics/src/CalendarStream.php perhaps the relevant file that determines the details that are clearly not configured correctly?)

Please also advise which logfile I should check to see the following logs as seen in your above post : (is it in the apache2/error.log?)

ERROR - 2023-10-11 23:20:19 --> Notifications - Could not email confirmation details of appointment (10) : Call to undefined function Jsvrcek\ICS\mb_strcut() ERROR - 2023-10-11 23:20:19 --> #0 /var/www/easy/vendor/jsvrcek/ics/src/CalendarExport.php(212): Jsvrcek\ICS\CalendarStream->addItem()

1 /var/www/easy/application/libraries/Ics_file.php(184): Jsvrcek\ICS\CalendarExport->getStream()

2 /var/www/easy/application/libraries/Notifications.php(85): Ics_file->get_stream()

3 /var/www/easy/application/controllers/Booking.php(571): Notifications->notify_appointment_saved()

4 /var/www/easy/system/core/CodeIgniter.php(481): Booking->register()

5 /var/www/easy/index.php(360): require_once('...')

6 {main}

thank you very much

geomax2024 commented 6 months ago

So installed Postfix which was absent. It now says that mail is sent successfully when i run a test script (php test_email.php) and port 25 is open for smtp on my aws ec2 instance security rules. All other tests succeed (ping, dns resolution, blacklist test) and all postfix, apache2 and program settings seems to be on a level. I am stumped why the emails are not received by my test mail inboxes, spam folders or anywhere... any advise would be great please thank you

geomax2024 commented 6 months ago

I have figured out the following and requested Aws to unblock port 25...

Short description By default, Amazon EC2 throttles instances on port 25 as a spam prevention measure. AWS blocks outbound traffic on port 25 (SMTP) of all EC2 instances and Lambda functions on elastic network interfaces owned by any account that isn't allow listed. AWS blocks this traffic to prevent damage to AWS IP reputation and to keep legitimate traffic from being marked as spam. For more information, see Restriction on email sent using port 25.

To send outbound traffic on port 25, complete the following steps:

Request that AWS remove the restriction. After you receive a response from AWS, follow the steps provided to you by AWS Support.