Menu

#897 Email smtp not funtion

None
open
nobody
None
9
2019-12-03
2016-02-18
Anonymous
No

hai admin MRBS i want to setting email smtp. my detail server.

  1. windows server 2003
  2. web server app xampp

why i can`t recive email report
plz help me

my setting config.inc.php

/**********************************************

 * Email settings
 **********************************************/

// WHO TO EMAIL
// ------------
// The following settings determine who should be emailed when a booking is made,
// edited or deleted (though the latter two events depend on the "When" settings below).
// Set to TRUE or FALSE as required
// (Note:  the email addresses for the room and area administrators are set from the
// edit_area_room.php page in MRBS)
$mail_settings['admin_on_bookings']      = TRUE;  // the addresses defined by $mail_settings['recipients'] below
$mail_settings['area_admin_on_bookings'] = FALSE;  // the area administrator
$mail_settings['room_admin_on_bookings'] = FALSE;  // the room administrator
$mail_settings['booker']                 = TRUE;  // the person making the booking
$mail_settings['book_admin_on_approval'] = FALSE;  // 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']      = FALSE; // 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'] = '';
// 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' or 'sendmail'. 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'] = '';

/*******************

 * SMTP settings
 */

// These settings are only used with the "smtp" backend
$smtp_settings['host'] = 'ssl://smtp.gmail.com';;  // SMTP server
$smtp_settings['port'] = 465;           // SMTP port number
$smtp_settings['auth'] = TRUE;        // Whether to use SMTP authentication
$smtp_settings['username'] = 'lksa.svr@gmail.com';       // 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'] = 'lksa.svr@gmail.com';

// 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.
$mail_settings['organizer'] = 'fitrie.ridzuan@prolintas.com.my';

// 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'] = 'fitrie.ridzuan@prolintas.com.my';

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

// 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'] = TRUE;

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

Discussion

  • Campbell Morrison

    The config settings look OK (assuming you've just deleted the password before posting the config). Have a look in your error_log to see what error messages you are getting. For more details set

    $mail_settings['debug'] = TRUE;
    

    If you are running MRBS 1.5.0 and aren't sure where your error log is, you can direct debug output to the browser by setting

    $mail_settings['debug_output'] = 'browser';
    
     
  • Anonymous

    Anonymous - 2016-02-19

    ok now email funtion. tanks you campbell

    how to cc ?

    $mail_settings['cc'] = 'jebat84@gmail.com; latifah@prolintas.com.my; hamizah@prolintas.com.my';

     
  • John Beranek

    John Beranek - 2016-02-19

    Separate multiple addresses with commas, it's only Outlook that uses semi-colons to separate multiple email addresses

     
    • Campbell Morrison

      I've added some more email address validation to the default branch in changeset 2a31d5467ac8.

       
  • Campbell Morrison

    Did you replace the semi-colons with commas?

     
  • John Beranek

    John Beranek - 2016-04-08

    I'm confused by the error, as it shows that PHPmailer is trying to use the PHP 'mail' function, but you've said you have configured MRBS for SMTP delivery.

    Could you ensure you definitely have the following set, and only one line like this?

    ::php
    $mail_settings['admin_backend'] = 'smtp';
    
     
  • Anonymous

    Anonymous - 2017-12-06

    Hi All;
    We are follow the setup for SMTP as below. Our room booking MRBS 1.4.11 is working fine until yesterday 5/12/22017. Now it is not working because: Error sending email: Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: (code: -1, response: )]
    I do not know why is not working. Please advise me. Thanks.

    / These settings are only used with the "smtp" backend $smtp_settings['host'] = 'ssl://smtp.gmail.com'; // SMTP server
    $smtp_settings['port'] = 465; // SMTP port number
    $smtp_settings['auth'] = TRUE; // Whether to use SMTP authentication
    $smtp_settings['secure'] = 'ssl'; // Encryption method: 'tls' or 'ssl'
    $smtp_settings['username'] = 'roombookingadmin@bisvietnam.net';

     

    Last edit: Anonymous 2017-12-06
  • Campbell Morrison

    Try switching to TLS

    $smtp_settings['port'] = 587; // SMTP port number
    $smtp_settings['secure'] = 'tls'; // Encryption method: 'tls' or 'ssl
    
     
    • Anonymous

      Anonymous - 2017-12-29

      hi, Campbell

      My mrbs version is 1.5.0, but it is not working since 2017/12/5.
      It can't send mail because "Failed to send email: SMTP connect() failed."

      My SMTP setting:

      $smtp_settings['host'] = 'smtp.gmail.com';  // SMTP server
      $smtp_settings['port'] = 587;           // SMTPport number
      $smtp_settings['auth'] = TRUE;        // 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) 
      

      Can you advise what should I do now?

       

      Last edit: Campbell Morrison 2017-12-29
  • Campbell Morrison

    First of all you should immediately change your gmail password.

    Next, I suggest you upgrade to MRBS 1.7.0 and then turn on mail debugging by setting

    $mail_settings['debug'] = true;
    $mail_settings['debug_output'] = 'browser';
    

    This will give you more information about why mail is failing.

    It's possible, if you are using PHP 5.6 or above, that the error message you will see is

    Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

    If you get this then you should follow the adivice on "Certificate verification failure" in https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting.

     
  • Anonymous

    Anonymous - 2019-02-07

    Hi, Campbell,

    I'm confused by the error, can u help me?

    [DEBUG] Preparing email for deleted booking
    [DEBUG] Preparing to send email ...
    [DEBUG] Using backend 'smtp'
    [DEBUG] From: xxxx
    [DEBUG] To: xxxx, xxxx
    [DEBUG] Cc: 
    [DEBUG] Bcc: 
    2019-02-07 12:46:07 Connection: opening to ssl://smtp.gmail.com:25, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => true, 'verify_peer_name' => true, 'allow_self_signed' => false, ),)
    2019-02-07 12:46:07 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol [.../mrbs/web/lib/PHPMailer/class.smtp.php line 299]
    2019-02-07 12:46:07 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [.../mrbs/web/lib/PHPMailer/class.smtp.php line 299]
    2019-02-07 12:46:07 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:25 (Unknown error) [.../mrbs/web/lib/PHPMailer/class.smtp.php line 299]
    2019-02-07 12:46:07 SMTP ERROR: Failed to connect to server: (0)
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    [DEBUG] Failed to send email: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    
     

    Last edit: Campbell Morrison 2019-02-07
  • Campbell Morrison

    What are your values of $smtp_settings in your config file? (Leave out sensitive information such as host, username and password).

     
  • Anonymous

    Anonymous - 2019-02-07

    $smtp_settings['host'] = 'ssl://smtp.gmail.com';; // SMTP server
    $smtp_settings['port'] = 25; // SMTP port number
    $smtp_settings['auth'] = TRUE; // Whether to use SMTP authentication
    $smtp_settings['secure'] = 'ssl'; // Encryption method: 'tls' or 'ssl'
    $smtp_settings['username'] = '**'; // Username (if using authentication)
    $smtp_settings['password'] = '
    *'; // Password (if using authentication)

     
  • Campbell Morrison

    Try

    $smtp_settings['host'] = 'smtp.gmail.com';  // SMTP server
    $smtp_settings['port'] = 587;           // SMTP port number
    $smtp_settings['auth'] = TRUE;        // Whether to use SMTP authentication
    $smtp_settings['secure'] = 'tls'; // Encryption method: 'tls' or 'ssl'
    
     
  • Anonymous

    Anonymous - 2019-02-07

    Returned this...

    [DEBUG] Cc: 
    [DEBUG] Bcc: 
    2019-02-07 13:39:43 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => true, 'verify_peer_name' => true, 'allow_self_signed' => false, ),)
    2019-02-07 13:39:43 Connection: opened
    2019-02-07 13:39:43 SERVER -> CLIENT: 220-cpl01.main-hosting.eu ESMTP Exim 4.91 #1 Thu, 07 Feb 2019 13:39:43 +0000 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
    2019-02-07 13:39:43 CLIENT -> SERVER: EHLO xxxx
    2019-02-07 13:39:43 SERVER -> CLIENT: 250-cpl01.main-hosting.eu Hello xxxx [177.234.151.98]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
    2019-02-07 13:39:43 CLIENT -> SERVER: STARTTLS
    2019-02-07 13:39:43 SERVER -> CLIENT: 220 TLS go ahead
    2019-02-07 13:39:43 Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`cpl01.main-hosting.eu' did not match expected CN=`smtp.gmail.com' [.../mrbs/web/lib/PHPMailer/class.smtp.php line 375]
    SMTP Error: Could not connect to SMTP host.
    2019-02-07 13:39:43 CLIENT -> SERVER: QUIT
    2019-02-07 13:39:43 
    2019-02-07 13:39:43 
    2019-02-07 13:39:43 Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    [DEBUG] Failed to send email: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    
     

    Last edit: Campbell Morrison 2019-02-07
  • Campbell Morrison

    Try adding

    $smtp_settings['ssl_verify_peer'] = false;
    $smtp_settings['ssl_verify_peer_name'] = false;
    $smtp_settings['ssl_allow_self_signed'] = true;
    

    Though if that works see https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting and note the comments under "Certificate verification failure"

     
  • Anonymous

    Anonymous - 2019-02-07

    I found the error... The e-mail that i was using not authorize the use of this system to transport unsolicited... I just modified the e-mail and sucess... Thank u a lot my friend.

     
  • John Beranek

    John Beranek - 2019-02-07

    I'm confused by the error message - it looks like your hosting company/organisation is intercepting connections to smtp.gmail.com, which is a very dubious thing to do security-wise!!

    A connection like that should either be allowed and get straight to Gmail, or it should be blocked by the firewall.

     
MongoDB Logo MongoDB