Welcome to Geeklog Monday, May 25 2020 @ 04:24 am EDT

Question: Configuring email

Answer: Starting with version 1.3.9, Geeklog uses the PEAR::Mail class to send all emails, offering you the following methods to send emails:

  • 'smtp', i.e. using an SMTP server
  • 'mail', i.e. using PHP's built-in mail function
  • 'sendmail', i.e. using the Unix sendmail application
All the following settings can be found in the Configuration admin panel (or in config.php, for older Geeklog versions).

SMTP
To configure Geeklog to send all emails using an SMTP server, set 'backend' to 'smtp' and enter the information to contact your SMTP server as follows:
    'host'     => 'name of your smtp server',
'port' => '25',
'auth' => false,
'username' => 'your smtp username',
'password' => 'your smtp password'
You should have gotten these settings from your ISP. The name of the smtp server is usually something like 'smtp.your-domain.com' but in some cases it's simply 'localhost'. The port number is usually 25. The 'auth' option tells Geeklog whether to use authentication or not (set to true for authentication).

mail
When setting 'backend' to 'mail' (which is also the default) Geeklog will use PHP's built-in mail() function. None of the other $_CONF['mail_settings'] options have to be changed for this.

This is almost like what Geeklog used in versions prior to 1.3.9. There is, however, a difference in how PEAR::Mail implements this option so that 'mail' can not be used when safe_mode is activate on your webserver. You will have to use one of the other options if that is the case for you.

sendmail
On most setups, there isn't any benefit in using this option - it's mainly provided for completeness. You can set the path to the sendmail binary ('sendmail_path') and pass additional arguments to sendmail by setting 'sendmail_args' accordingly.

Which method should I use?
If you can, SMTP is probably the best method to use. It ensures that the email is sent through your SMTP server which reduces the chances that emails are regarded as spam by some of the more strict mail filters.

'mail' is the second-best option but, as noted above, won't work when safe_mode is on.

A fourth option
If none of the above methods work for you, there is a fourth option: You can implement your own function to send email. This may be necessary on some free hosting services that disable PHP's mail function.

The function must be called CUSTOM_mail. A sample implementation is included in the lib-custom.php file that ships with Geeklog. This sample code is a re-implementation of the way Geeklog sent emails prior to 1.3.9. It also uses PHP's mail function, but in such a way that it will work when safe_mode is on.

Please note that the function is commented out by default - you will have to remove the comments around the function before it will be used.

FAQ » Installation » Configuring email