meeting-room-booking-system / mrbs-code

MRBS application code
Other
108 stars 56 forks source link

MRBS V.1.4.11 Email not send (When use PHP V. higher than 5.2.6) #530

Open jberanek opened 9 years ago

jberanek commented 9 years ago

Thank you very much for the best free system. I'm newbie php code. In my case all feature is work good but I found some problem about sending Email for approve.

I test setting following (PHP higher than 5.2.6) $smtp_settings['host'] = 'mail.mycompany.com'; // SMTP server $smtp_settings['port'] = 25; // SMTP port number $smtp_settings['auth'] = TRUE; // Whether to use SMTP authenticatio $smtp_settings['username'] = 'xxxxxx'; // Username (if using authentication) $smtp_settings['password'] = 'xxxxxx'; // Password (if using authentication)

It work fine on MRBS 1.4.11 PHP: 5.2.6 apache 2.2.8

But my host is MRBS 1.4.11 MySQL 5.1.69 PHP: 5.3.3 have the same problem too. (Email not send)

How to config to use send mail in normally

I need your help. Thank you so much. Best regards

Reported by: *anonymous

Original Ticket: mrbs/bugs/322

jberanek commented 9 years ago

Are these two different servers you are testing on? If so, I doubt that the issue is to do with the version of PHP. Have you tried sending SMTP mail using those details from another application (eg an email client)?

Original comment by: campbell-m

jberanek commented 9 years ago

Thank you for your reply

On Local Yes I test more than two server (@mycompany.com) use XAMPP 5.6.3 error on debug page Error page DEBUG] Preparing email for new or changed booking ... [DEBUG] Preparing to send email ...

After I change to AppServ 2.5.10 email can send normally.

I test setting email client eg outlook can use normally.

More detail

First time I use XAMPP V 5.6.3 have problem about send Email.I changed to AppServ 2.5.10 email can send normally.

XAMPP: https://www.apachefriends.org/index.html Appserv: http://www.appservnetwork.com/modules.php?name=News&file=article&sid=46

Online Now I want to upload this system on hosting for online. I have error when booking Error code:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

I press back page. User can booking but system not sending email.

Hosting system: MRBS 1.4.11 MySQL 5.1.69 PHP: 5.3.3

Thank you Best regards

Original comment by: *anonymous

jberanek commented 9 years ago

Can you look at the server error log and see what the error message is?

Original comment by: campbell-m

jberanek commented 9 years ago

Hmm, I've got problems sending email via SMTP with authentication on my test system too. When I perform an action that sends an email the action takes a long time - on the server I can see the SMTP connection though:

tcp 0 0 localhost:37384 localhost:smtp ESTABLISHED

This is with trunk MRBS, PHP 5.6.1

Original comment by: jberanek

jberanek commented 9 years ago

I've just tested with trunk and PHP 5.6.5. SMTP mail works OK, though it maybe adds a couple of seconds.

Anonymous - have you checked that the port (465?) that you're using to connect to the SMTP server on your system is open?

Original comment by: campbell-m

jberanek commented 9 years ago

Well, oddly enough, looking at a network capture with my failure when using SMTP authentication looks like:

EHLO localhost
STARTTLS
QUIT

I've not explicitly configured TLS...

Original comment by: jberanek

jberanek commented 9 years ago

The following from Net_SMTP.php would explain that:

    function auth($uid, $pwd , $method = '', $tls = true, $authz = '')
    {
        /* We can only attempt a TLS connection if one has been requested,
         * we're running PHP 5.1.0 or later, have access to the OpenSSL
         * extension, are connected to an SMTP server which supports the
         * STARTTLS extension, and aren't already connected over a secure
         * (SSL) socket connection. */

Original comment by: jberanek

jberanek commented 9 years ago

Sorry, both sides of the SMTP conversation this time:

220 home.redux.org.uk ESMTP Postfix
EHLO localhost
250-home.redux.org.uk
250-PIPELINING
250-SIZE 36700160
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
STARTTLS
220 2.0.0 Ready to start TLS
QUIT

Original comment by: jberanek

jberanek commented 9 years ago

If I force 'Mail_smtp' to tell Net_SMTP to not use TLS for auth (and configure my mail server to allow auth without TLS) then the issue goes away.

So, it looks to be to do with Net_SMTP's TLS support.

Original comment by: jberanek

jberanek commented 8 years ago

Email alert using backend method smtp is still not working. my config details

$mail_settings['admin_on_bookings']      = TRUE;  // the addresses defined by $mail_settings['recipients'] below
$mail_settings['area_admin_on_bookings'] = TRUE;  // the area administrator
$mail_settings['room_admin_on_bookings'] = TRUE;  // the room administrator
$mail_settings['booker']                 = TRUE;  // the person making the booking
$mail_settings['book_admin_on_approval'] = TRUE;  // the booking administrator when booking approval is enabled
                                                   // (which is the MRBS admin, but this setting allows MRBS
                                                   // to be extended to have separate booking approvers)

// WHEN TO EMAIL
// -------------
// These settings determine when an email should be sent.
// Set to TRUE or FALSE as required
//
// (Note:  (a) the variables $mail_settings['admin_on_delete'] and
// $mail_settings['admin_all'], which were used in MRBS versions 1.4.5 and
// before are now deprecated.   They are still supported for reasons of backward
// compatibility, but they may be withdrawn in the future.  (b)  the default
// value of $mail_settings['on_new'] is TRUE for compatibility with MRBS 1.4.5
// and before, where there was no explicit config setting, but mails were always sent
// for new bookings if there was somebody to send them to)

$mail_settings['on_new']    = TRUE;   // when an entry is created
$mail_settings['on_change'] = TRUE;  // when an entry is changed
$mail_settings['on_delete'] = TRUE;  // when an entry is deleted

// WHAT TO EMAIL
// -------------
// These settings determine what should be included in the email
// Set to TRUE or FALSE as required
$mail_settings['details']   = TRUE; // Set to TRUE if you want full booking details;
                                     // otherwise you just get a link to the entry
$mail_settings['html']      = TRUE; // Set to true if you want HTML mail
#$mail_settings['icalendar'] = FALSE; // Set to TRUE to include iCalendar details
                                     // which can be imported into a calendar.  (Note:
                                     // iCalendar details will not be sent for areas
                                     // that use periods as there isn't a mapping between
                                     // periods and time of day, so the calendar would not
                                     // be able to import the booking)

// HOW TO EMAIL - LANGUAGE
// -----------------------------------------

// Set the language used for emails (choose an available lang.* file).
$mail_settings['admin_lang'] = 'en';   // Default is 'en'.

// HOW TO EMAIL - ADDRESSES
// ------------------------
// The email addresses of the MRBS administrator are set in the config file, and
// those of the room and area administrators are set though the edit_area_room.php
// in MRBS.    But if you have set $mail_settings['booker'] above to TRUE, MRBS will
// need the email addresses of ordinary users.   If you are using the "db"
// authentication method then MRBS will be able to get them from the users table.  But
// if you are using any other authentication scheme then the following settings allow
// you to specify a domain name that will be appended to the username to produce a
// valid email address (eg "@domain.com").
$mail_settings['domain'] = '@iitb.ac.in';
// If you use $mail_settings['domain'] above and username returned by mrbs contains extra
// strings appended like domain name ('username.domain'), you need to provide
// this extra string here so that it will be removed from the username.
$mail_settings['username_suffix'] = '';

// HOW TO EMAIL - BACKEND
// ----------------------
// Set the name of the backend used to transport your mails. Either 'mail',
// 'smtp', 'sendmail' or 'qmail'. Default is 'mail'.
$mail_settings['admin_backend'] = 'smtp';

/*******************
 * Sendmail settings
 */

// Set the path of the Sendmail program (only used with "sendmail" backend).
// Default is '/usr/bin/sendmail'
#$sendmail_settings['path'] = '/usr/bin/sendmail';
// Set additional Sendmail parameters (only used with "sendmail" backend).
// (example "-t -i"). Default is ''
#$sendmail_settings['args'] = '';

/*******************
 * Qmail settings
 */

/* Configures the path to 'qmail-inject', if unset defaults to '/var/qmail/bin/qmail-inject' */
#$mail_settings['qmail']['qmail-inject-path'] = '/usr/bin/qmail-inject';

/*******************
 * SMTP settings
 */

// These settings are only used with the "smtp" backend
$smtp_settings['host'] = 'abhikalpa.idc.iitb.ac.in';  // SMTP server
$smtp_settings['port'] = 25;           // SMTP port number
#$smtp_settings['auth'] = FALSE;        // Whether to use SMTP authentication
#$smtp_settings['secure'] = 'tls';      // Encryption method: 'tls' or 'ssl'
#$smtp_settings['username'] = '';       // Username (if using authentication)
#$smtp_settings['password'] = '';       // Password (if using authentication)

// EMAIL - MISCELLANEOUS
// ---------------------

// Set the email address of the From field. Default is 'admin_email@your.org'
$mail_settings['from'] = '$mrbs_admin_email';

// The address to be used for the ORGANIZER in an iCalendar event.   Do not make
// this email address the same as the admin email address or the recipients
// email address because on some mail systems, eg IBM Domino, the iCalendar email
// notification is silently discarded if the organizer's email address is the same
// as the recipient's.  On other systems you may get a "Meeting not found" message.
#$mail_settings['organizer'] = 'mrbs@your.org';

// Set the recipient email. Default is 'admin_email@your.org'. You can define
// more than one recipient like this "john@doe.com,scott@tiger.com"

$mail_settings['recipients'] = '$mrbs_admin_email';

// Set email address of the Carbon Copy field. Default is ''. You can define
// more than one recipient (see 'recipients')
#$mail_settings['cc'] = '';

// Set to TRUE if you want the cc addresses to be appended to the to line.
// (Some email servers are configured not to send emails if the cc or bcc
// fields are set)
#$mail_settings['treat_cc_as_to'] = FALSE;

// The filename to be used for iCalendar attachments.   Will always have the
// extension '.ics'
#$mail_settings['ics_filename'] = "booking";

// Set this to TRUE if you want MRBS to output debug information when you are sending email.
// If you are not getting emails it can be helpful by telling you (a) whether the mail functions
// are being called in the first place (b) whether there are addresses to send email to and (c)
// the result of the mail sending operation.
$mail_settings['debug'] = TRUE;
// Where to send the debug output.  Can be 'browser' or 'log' (for the error_log)
$mail_settings['debug_output'] = 'log';

// Set this to TRUE if you do not want any email sent, whatever the rest of the settings.
// This is a global setting that will override anything else.   Useful when testing MRBS.
$mail_settings['disabled'] = FALSE;

Original comment by: *anonymous

jberanek commented 8 years ago

Is this related to this ticket? Or is this a different problem?

Original comment by: campbell-m