phpScheduleIt
May 22, 2013, 04:07:58 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: SMTP Mail Setup  (Read 2671 times)
kghs_itl
Newbie
*

Karma: 0
Posts: 5


« on: October 26, 2011, 01:57:31 PM »

I am having trouble getting SMTP to work with Gmail in PHPScheduleIt.

Here are what I believe to be the related areas of code:
Smtp.class.php
Code:
/**
     *  SMTP server port
     *  @var int
     */
    var $SMTP_PORT = 465;
    var $SMTP_HOST = 'smtp.gmail.com';

PHPMailer.class.php
Code:
/**
     * Method to send mail: ("mail", "sendmail", or "smtp").
     * @var string
     */
    var $Mailer            = "smtp";
and...
Code:
/**
     *  Sets the SMTP hosts.  All hosts must be separated by a
     *  semicolon.  You can also specify a different port
     *  for each host by using this format: [hostname:port]
     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
     *  Hosts will be tried in order.
     *  @var string
     */
    var $Host        = "smtp.gmail.com";

    /**
     *  Sets the default SMTP server port.
     *  @var int
     */
    var $Port        = 465;

    /**
     *  Sets the SMTP HELO of the message (Default is $Hostname).
     *  @var string
     */
    var $Helo        = "";

    /**
     *  Sets SMTP authentication. Utilizes the Username and Password variables.
     *  @var bool
     */
    var $SMTPAuth     = "true";

    /**
     *  Sets SMTP username.
     *  @var string
     */
    var $Username     = "user@gmailaddress";

    /**
     *  Sets SMTP password.
     *  @var string
     */
    var $Password     = "********";

    /**
     *  Sets the SMTP server timeout in seconds. This function will not
     *  work with the win32 version.
     *  @var int
     */
    var $Timeout      = 10;

    /**
     *  Sets SMTP class debugging on or off.
     *  @var bool
     */
    var $SMTPDebug    = true;

    /**
     * Prevents the SMTP connection from being closed after each mail
     * sending.  If this is set to true then to close the connection
     * requires an explicit call to SmtpClose().
     * @var bool
     */
    var $SMTPKeepAlive = false;

config\config.php
Code:
// How to send email ['mail']
/* Options are:
    'mail' for PHP default mail
    'smtp' for SMTP
    'sendmail' for sendmail
    'qmail' for qmail MTA
*/
$conf['app']['emailType'] = 'smtp';

// SMTP email host address []
// This is only required if emailType is SMTP
$conf['app']['smtpHost'] = 'smtp.gmail.com';

// SMTP port [25]
// This is only required if emailType is SMTP
$conf['app']['smtpPort'] = 465;

php.ini
Code:
[mail function]
; For Win32 only.
SMTP = "smtp.gmail.com"
smtp_port = 465

; For Win32 only.
sendmail_from = "noreply@kgcs.k12.va.us"

Here are the errors:
Fatal error: mail() [function.mail]: Failed to connect to mailserver at "smtp.gmail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\Program Files\wamp\www\kgcsres\lib\Reservation.class.php on line 743

Fatal error: Maximum execution time of 60 seconds exceeded in D:\Program Files\wamp\www\kgcsres\lib\Reservation.class.php on line 744

(First two happen when creating a reservation)

Fatal error: Maximum execution time of 60 seconds exceeded in D:\Program Files\wamp\www\kgcsres\lib\Smtp.class.php on line 1018

(This one happens when deleting a reservation)

I tried adding ssl:// in front of smtp.gmail.com, but got and fsockopen error related to the length. Has anyone successfully set up SMTP with Gmail and PHPScheduleIt? Any ideas on what I am doing wrong? Thanks in advance.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #1 on: October 31, 2011, 01:27:38 PM »

I'm *guessing* this is because that version of PHPMailer doesn't appear to have an option for secure SMTP.  You can try dropping in the new version http://phpmailer.worxware.com/ following this tutorial http://www.24hourapps.com/2009/02/php-mail-using-gmail-smtp-and-phpmailer.html
Logged
kghs_itl
Newbie
*

Karma: 0
Posts: 5


« Reply #2 on: November 01, 2011, 01:27:23 PM »

You are probably right, but I can't tell you I tried. I was able to get it working by using a non-secure address on port 25. It seems that everything else was configured properly. I may try the updated version with the secure connection at some point in the future. Thanks for the reply.
Logged
DSL
Newbie
*

Karma: 0
Posts: 3


« Reply #3 on: November 22, 2011, 04:37:47 PM »

You should be able to get it work with sendmail : http://glob.com.au/sendmail/ (work for both linux and windows).
Set the SMTP parameters inside the sendmail.ini file after install, then change the configuration of your config.php file (wich really controls the way mails are sent by phpscheduleit) by pointing to the sendmail application path:

config.php
Code:
// How to send email ['mail']
/* Options are:
    'mail' for PHP default mail
    'smtp' for SMTP
    'sendmail' for sendmail
    'qmail' for qmail MTA
*/
$conf['app']['emailType'] = 'sendmail';

// SMTP email host address []
// This is only required if emailType is SMTP
// $conf['app']['smtpHost'] = 'johndoe@mailserver.com';

// SMTP port [25]
// This is only required if emailType is SMTP
// $conf['app']['smtpPort'] = 25;

// Path to sendmail ['/usr/sbin/sendmail'] for linux
// ['C:\path_where_you_put_sendmail\sendmail.exe -t'] for windows
// This only needs to be set if the emailType is 'sendmail'
$conf['app']['sendmailPath'] = 'path to sendmail';

Configure your firewall to let sendmail actually send emails...

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!